Goals from Paul Pogba and Juan Cuadrado gave Massimiliano Allegri's men a shock 2-0 lead at the interval, but the Bavarians fought back through Robert Lewandowski and Thomas Muller's late header forced extra-time.
Thiago Alcantara then gave Bayern the lead for the first time in the 108th minute, before Kingsley Coman's vicious strike made it 6-4 on aggregate and sent the German giants into the last eight, where they could meet Manchester City; the club Pep Guardiola is set to join this summer.
Massimiliano Allegri was unable to call upon key men Paulo Dybala, Claudio Marchisio and Giorgio Chiellini, but a stunning display of counter-attacking gave them hope of pulling off a stunning win.
Bayern had blown a two-goal advantage in the first leg and were relentless in ensuring the Italians suffered a repeat of sorts, with Juve's stiff resistance wilting after Lewandowski's strike as the Bundesliga leaders kept Pep Guardiola's hopes of bowing out of Bavaria with Champions League success alive.
It had not looked so sweet when Bayern gifted Juve their sixth-minute opener, however.
Manuel Neuer inexplicably rushed off his goalline as David Alaba, under pressure from Stephan Lichtsteiner, failed to control a long ball from Sami Khedira and Pogba calmly stroked the loose ball beyond two covering defenders and into the net.
Franck Ribery wildly blasted a volley over the crossbar as Bayern pushed for an instant equaliser, while Muller failed to trouble Gianluigi Buffon with a header from a dangerous position.
Alvaro Morata lobbed Neuer after another error from the goalkeeper, but his smart effort was chalked off by the linesman, although replays suggested the Juventus striker was onside.
It mattered little as Juve doubled their lead in stunning fashion in the 28th minute. Morata danced past a number of opponents as he charged forward from inside his own half before setting up Cuadrado, who took a touch to slip past Philipp Lahm and beat Neuer with a fine shot at his near post.
Muller was denied by Buffon from close range and Juve were fortunate as an attempted clearance hit Lewandowski and bobbled just wide.
Cuadrado should have put the tie to bed in the 44th minute after a low cross from the left, only for Neuer to partially make amends for his previous mistakes with a stunning reflex save.
Morata continued to cause the Bayern defence all kinds of trouble after the interval and he came close to adding a third, but his shot took a deflection off Alaba before drifting over the crossbar.
The hosts' focused their attacks out wide but initially struggled to create chances of note, until Lewandowski headed home in the 73rd minute after Douglas Costa delivered a stunning cross from the right flank.
Bayern completed their comeback well into stoppage time, with Muller heading home from close range after a pinpoint cross from substitute Coman to send the game into extra time.
Lichtsteiner could have restored Juve's lead in the 93rd minute after being set up by Mario Mandzukic, but his effort lacked the power to surprise Neuer.
Thiago then had Bayern ahead for the first time in the game when he fired home in the 108th minute after a quick one-two with Muller.
And Coman came back to haunt his previous employers as he put the tie to bed two minutes later after darting in from the right.