The deal comes after reports had linked the 26-year-old with Real Madrid and Manchester United.
With microphone in hand, Schweinsteiger kissed the Bayern badge on his chest after telling his side's fans at Munich's Allianz Arena: "It is the best solution for both sides."
"I think we have a very good group here," he said. "My heart is here. My heart is red. I've extended my contract for you."
The news is a big boost for Bayern's bosses, as Germany defender Philipp Lahm also pledged his future to Munich earlier this autumn by signing a deal which keeps him in Bavaria until at least 2016.
Schweinsteiger said he made the decision to stay in Germany in the hopes of success with both club and country, having made his Munich debut in 2002.
"It would be nicer to win the Champions League here than with Real Madrid," he said.
"We are on the right track with our trainer and doing well in Europe. This is the best long-term solution."
The news had coach Louis van Gaal, who guided Bayern to the German double and Champions League final last season, beaming.
"I am a coach with long-term goals," he said. "So the signing of Bastian Schweinsteiger was important. It is a very good sign when world-class players stay with Bayern."
Schweinsteiger is one of the first names on Germany coach Joachim Löw's team-sheet as vice-captain. He was a major star of the World Cup in South Africa and has a market value of around €35 million.
But he drove a hard bargain, according to Bayern president Uli Hoeneß.
"The negotiations were difficult," the Bayern boss admitted. "It was about hard currency."
When his contract expires in June 2016, Schweinsteiger will be 31 years old and will probably end his career at the German champions.
Bavarian born and bred, Schweinsteiger joined Bayern in 1998, winning the German U-17 and U-19 championship with Munich before earning a professional contract.
Schweinsteiger is a five-time domestic double winner and has appeared in the Champions League final.
Bayern are fifth in the Bundesliga and have reached the last 16 in the Champions League.