"We are delighted that Dante is coming to us," said Bayern sports director Christian Nerlinger. "He is a very good and prominent Bundesliga player who will help us reach our goals in the coming four years."
The Brazilian, who joined Gladbach in 2009 from Belgium's Standard Liege, quickly earned a starting spot at the heart of the Germans' defence and was key in their fine Bundesliga season that has seen them battle for a Champions League place.
Little known in his native Brazil, the 28-year-old also scored crucial goals last season that helped Gladbach stay up following a relegation play-off.
Bayern, who had Daniel van Buyten ruled out for much of this season while defensive partner Breno has had fitness and legal troubles, had been looking for a reliable central defender for months.
"Bayern are one of the world's biggest clubs and there I can have the chance to play at the very highest of levels and win titles," Dante said in a statement.
"I am now 28 years old and want to take that next step in my career."
He has played 91 league games for Gladbach, scoring eight times.