Rossi revs up until 2010
"Yamaha told me you decide how long you want to extend it for, and I have decided it will be two years," said the Italian.
"I wanted to wait and see how much motivation I had left to continue."
The 29-year-old is in Spain for the Catalan Grand Prix after winning his third race on the trot in Italy last week.
The circuit at Montmelo is one of Rossi's favourite and the seven-times world champion has notched eight victories in all classes there.
His closest rivals in the championship are Spaniards Dani Pedrosa and Jorge Lorenzo, second and third respectively, who will be racing in front of their home fans.
But Rossi is particularly keen to beat defending world champion Australian Casey Stoner.
"I like this course a lot and it also means I can get my revenge on Stoner who beat us here last year. It was a great one-on-one until the last lap," said Rossi.
"It's difficult to predict who will be the most dangerous tommorrow, the Spaniards or Stoner," said Rossi.