The defender's current deal at Old Trafford was set to expire at the end of this season but he will now remain at the club for a further 12 months, with the option of a further year.
Maguire has started every match since Michael Carrick took interim charge of United in January and has helped the club rise to third in the Premier League table, leaving them well-placed to qualify for next season's Champions League.
The England international told United's website after penning the new deal: "Representing Manchester United is the ultimate honour. It is a responsibility that makes myself and my family proud every single day.
"I am delighted to extend my journey at this incredible club to at least eight seasons and continue to play in front of our special supporters to create more amazing moments together.
"You can feel the ambition and potential of this exciting squad. The determination throughout the whole club to fight for major trophies is clear for everyone to see and I am confident that our best moments together remain ahead of us."
Maguire has made over 250 appearances for United since joining from Leicester in 2019 for £80 million - still a world record transfer fee for a defender - and has won the FA Cup and Carabao Cup during his spell with the Red Devils.
United's director of football Jason Wilcox said: "Harry represents the mentality and resilience required to perform for Manchester United. He is the ultimate professional who brings invaluable experience and leadership to our young, ambitious squad.
"Harry, like everyone at the club, is completely determined to help Manchester United to achieve regular and sustained success."