The 24-year-old Germany left-back had also been strongly linked with Barcelona and only a few weeks ago, the player rated his own chances of leaving at 50/50.
However, a meeting last week with future Bayern coach Jurgen Klinsmann has convinced him to put pen to paper on a new deal and commit himself to the German champions for a further three years.
"I am really looking forward to staying here, otherwise I would not have done it," said Lahm at a press conference.
"My aim is to win the Champions League with FC Bayern and I am convinced we can do it in the near future."
Ottmar Hitzfeld, who said the new contract was "the best decision" both the player and the club could take.
"Philipp Lahm has a great future ahead of him," added Hitzfeld at his final press conference as Bayern coach at the club's training ground.
"He is a fantastic player who is already one of the best in the world."