Valentino Rossi will leave Ducati at the end of the season after signing a two-year contract with Yamaha.
Rossi, 33, will race alongside rival Jorge Lorenzo after rejoining the team he left at the end of 2010.
The Italian won 46 Grand Prix races and four world champion titles over a seven-year period with Yamaha.
"By signing Jorge Lorenzo and Valentino Rossi, we have put together the strongest possible team," said Lin Jarvis, Yamaha managing director.
Rossi is currently eighth in the championship standings. Lorenzo leads the 2012 MotoGP World Championship by 23 points and has taken five victories from the 10 races so far.
"This announcement is once again excellent news for Yamaha," added Jarvis.
"In June, we were able to sign Jorge Lorenzo for the 2013-14 campaign and now we are able to confirm Valentino Rossi for the next two years.
"We have run this 'super team' together in 2008, 2009 and 2010 and during that time we achieved the 'triple crown' titles with rider, manufacturer and team world championship victories for three consecutive years.
"I have no doubt that, with the experience, knowledge, skills and speed of these two great champion riders, we will be able to challenge for many race wins and for the 2013 and 2014 world championship titles."
Lorenzo's current team-mate, Ben Spies, had already confirmed he will leave Yamaha at the end of the season.