Lassana Coulibaly swept in from Silas Wamangituka’s excellent low cross to put Stuttgart ahead on the counter-attack.
Kingsley Coman levelled for Bayern and Robert Lewandowski’s powerful strike completed a first-half turnaround.
Juventus loanee Douglas Costa found the corner to add a third for Bayern.
They remain two points above RB Leipzig after their 2-1 win over Arminia Bielefeld on Saturday, and are now four ahead of third-placed Borussia Dortmund, who were beaten 2-1 by Cologne.
Philipp Forster was denied a second for Stuttgart one minute after Coman’s equaliser, as Coulibaly was retrospectively penalised for a foul in robbing Bayern keeper Manuel Neuer of possession.
Lewandowski’s goal is his 12th in eight Bundesliga appearances this season – and his 17th in 18 games for club and country in 2020-21.
The Poland international scored his 71st Champions League goal to become the joint-third top scorer in the competition’s history on Wednesday, as Bayern beat Red Bull Salzburg 3-1 to qualify for the knockout stage with two games to spare.
Lewandowski, 32, headed onto the post in the opening minutes before producing a quality finish from the edge of the penalty area, after Coman had slotted in after 38 minutes.
Former Manchester City winger Leroy Sane set up Costa, who cut in from the right to confirm victory in the closing stages.
Bayern travel to Atletico Madrid in the Champions League on Tuesday (20:00 GMT), before hosting title rivals Leipzig next Saturday.