The England striker said earlier this week that he did not intend to extend a deal that was due to expire in 2012 because he was unhappy at United's lack of ambition, but changed his mind after discussions with the club.
"I'm delighted to sign another deal at United," Rooney said in a statement released by United. "In the last couple of days, I've talked to the manager and the owners and they've convinced me this is where I belong."
United manager Alex Ferguson said he was "delighted" Rooney had agreed to extend his contract.
"Sometimes, when you're in a club, it can be hard to realize just how big it is and it takes something like the events of the last few days to make you understand," Ferguson said in the statement. "I think Wayne now understands what a great club Manchester United is.
"It's been a difficult week, but ... I said to the boy that the door is always open."
Rooney's representatives met with Ferguson and United chief executive David Gill on Thursday in a bid to resolve an issue that was sparked two days earlier when a "shocked" and "bemused" Ferguson revealed the striker wanted to leave Old Trafford.
Ferguson said Tuesday he did not understand the reasons behind Rooney's decision, only for the player to release a statement the following day detailing his concerns with United's squad strength. Rooney also claimed he had not been given any assurances by Gill about the club's future.
His form has dipped dramatically this season, with his private life becoming the subject of newspaper allegations that he had repeatedly cheated on his then-pregnant wife with a prostitute.
Rooney's relationship with Ferguson, which was widely reported to have broken down as a result of those allegations, appeared to worsen when the player publicly contradicted claims by his manager that he had been struggling with an ankle injury this season.
The 24-year-old Rooney said it is primarily Ferguson who has convinced him to remain at the 18-time English champions and is now determined to get back in United supporters' favor.
"I'm sure the fans over the last week have felt let down by what they've read and seen. But my position was from concern over the future," Rooney said. "The fans have been brilliant with me since I arrived and it's up to me through my performances to win them over again."
Rooney joined United in 2004 for 26.5 million pounds and helped the club to Premier League titles in 2007, '08 and '09. He also was a member of the side that won the Champions League in 2008.
"I'm sure everyone involved with the club will now get behind Wayne and show him the support he needs to produce the performances we know he is capable of," Ferguson said.
Rooney is currently out with an ankle injury sustained in training on Tuesday, on the eve of United's Champions League match against Bursaspor.
He has scored just one goal for his club this season - a penalty against West Ham - having netted 34 in all competitions last term to help earn him the Premier League's Footballer of the Year award.