Bayern secured its 35th German championship with a 4-2 victory over VfB Stuttgart, with four matches left to play.