The Austria left-back, 23, had been linked with Manchester City, who Bayern boss Pep Guardiola has agreed to join.
The Bayern youth product has won four Bundesliga titles and the Champions League since making his debut in 2010.
"He'll continue to be one of the cornerstones of our team in years to come," said Bayern chairman Karl-Heinz Rummenigge on the club's website.
Alaba has featured in 22 of Bayern's 26 games this season as Guardiola's side have established a five-point lead at the top of the Bundesliga.
"I grew up at Bayern and I've experienced unbelievably wonderful moments here," he said.
"We're all hungry to add further trophies to the ones we've already won."
Bayern Munich defender David Alaba has signed a three-year contract extension that ties him to the club until 2021.