Rooney said: "I am made up to be staying at United. In August I will have been at the club for 10 years and during that time I have played with some fantastic players and won everything that I hoped I would when I first signed. I now have the chance as one of the club's senior players to help the younger players coming through and to be a part of another great United team.
"The fans have always been a huge part of this club and the support they have given me since my debut against Fenerbahce has been amazing. I am very grateful to all United fans around the world for their continued support.
"I am really excited to be a part of the club's future and want to thank David Moyes and Ed Woodward for their belief and support in me. I am convinced that this is the start of another successful chapter in Manchester United's history."
United manager David Moyes said: "Wayne has been the best player in England since I put him into the Everton first team in 2003. Since becoming United manager in July last year, I have enjoyed working with him and seeing just how he has developed his incredible talent. With his ability, his experience and his desire to succeed, he is a vital part of my plans for the future and I'm absolutely thrilled he has accepted the challenge.
"I said last July that Wayne has an outstanding chance to be a true legend of this club's long and rich history. He is just 42 goals away from overtaking Sir Bobby as our record goalscorer and becoming the first United player to hit 250 goals for the club. These opportunities only come to special players and I'm confident Wayne will set a new record that will take decades to reach. These are really exciting times for everyone connected with the club."
Sir Alex Ferguson said last summer Rooney had requested to leave the club, which the forward privately denied. However, he was understood to be keen on joining José Mourinho's second coming at Chelsea, three seasons on from handing a transfer request in October 2010.
However, with his previous contract due to expire at the end of the 2014-15 season, United have extended Rooney's Old Trafford stay nearly 10 years on from when Ferguson signed him.
Rooney seemed destined to leave United had Ferguson not retired last year. The signings of Shinji Kagawa and Robin van Persie marginalised the England international, who became concerned about his role in the team.
Moulded as a No.10 playmaker at Everton, Ferguson rarely used Rooney in that position on a consistent basis, as he initially preferred to build a team around Cristiano Ronaldo.
When Ronaldo left in 2009, Rooney was converted into a striker and enjoyed his best season in 2009-10, but has struggled to replicate the performances he delivered that campaign.
His transfer request in 2010 - partially motivated by United's failure to sign Mesut Özil - was rescinded, as he received a new five-year £250,000-a-week reward.
Although Rooney matched his 34-goal haul in 2009-10 two years later, his performance level since the South Africa World Cup has significantly dropped and many United supporters are sceptical about the club's decision to gift him a pay rise.
Juan Mata, another No.10, joined for a club-record £37.1m last month but is yet to play off Van Persie, with Moyes keen to reserve the role for the player he gave his professional debut to at Everton.