The England striker's future had been the source of speculation since Chelsea attempted to sign the striker last year.
With 18 months left on his previous deal, some of Europe's top clubs began to take an interest in the 28-year-old, but on Friday night he committed his future to United.
As part of his new long-term deal, Rooney will also become a club ambassador for United when he retires from the game.
"I am made up to be staying at United," said Rooney, who has scored 208 goals in 430 appearances for the club.
"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.
Rooney's contract is understood to be worth around £300,000 a week and will be a welcome boost for United fans, who have seen their team slip 11 points off the pace in the hunt for Champions League football.
"I am thrilled that we have got Wayne Rooney to stay," said United boss David Moyes.
"He has been fantastic. Everyone would want him in their team.
"There were clubs who did want him. There were clubs who would have wanted him (had he not signed a new deal) but there was never going to be a chance he was going to leave Manchester United, certainly not on my watch."
Rooney has scored 11 goals during an injury-interrupted season and is tipped to succeed Nemanja Vidic as captain at the end of the season.
The Merseysider, who joined United from Everton in 2004, could now spend the rest of his days at Old Trafford and will be keen to beat Sir Bobby Charlton's record of 249 goals for the club.
"Wayne is a great player and hopefully we can keep him at a really high level which he has shown this season," added Moyes.
"Part of the rebuilding (process) is making sure that you keep the players you really want to keep.
"We are looking to bring the best players in the world to the club. I think Wayne Rooney is one of them.
"I will be looking to make more signings in the summer and hopefully add to the quality we already have got."
Sky Sports expert Gary Neville, who spent seven years playing alongside Rooney at Old Trafford, believes Moyes deserves credit for his role in the deal and can understand why he has been given such a lucrative deal.
"Talking about Wayne Rooney and the money he is signing for, the question you have to ask is how much does it cost to replace him?" said Neville.
"The market now is demanding. For a player who has scored the goals that he has scored in his ten years at United, you would be talking £50, £60million.
"I think from that point of view, the market forces that you have to pay the player what it would cost to replace him."