The hosts went into tonight's semi-final second leg at the Bernabeu in the driving seat following their 2-1 victory in Munich last week, but they were forced to hang on in the closing stages as Bayern recorded a 2-2 draw in the Spanish capital.
The visitors made their intentions clear when they took the lead after only three minutes through Joshua Kimmich, but Madrid were level just eight minutes later as Karim Benzema celebrated his return to the side with a goal.
A monumental mistake from Bayern goalkeeper Sven Ulreich then gifted Benzema a second less than one minute into the second half, and despite Real Madrid loanee James Rodriguez restoring parity once again on the night, Bayern could not find the one more goal they needed to end Madrid's two-year reign as European champions.
The German giants were left to rue a string of errors and missed chances over the two legs as they were dumped out of the competition by Spanish opposition for the fifth successive year, while Madrid will now have the chance to become the first team since Bayern themselves in 1976 to win the trophy three years in a row when they face either Liverpool or Roma in the final.
While the first leg belied the quality of the two teams for long spells, the second was played at a quick tempo from the off and Bayern were rewarded for their early adventure when they took the lead after only three minutes.
Sergio Ramos failed to cut out a cross into the box which hit Corentin Tolisso and fell at the feet of Kimmich, who followed up his first-leg goal by sweeping his finish into the corner from close range.
It took a diligent piece of defending from Thomas Muller to deny Cristiano Ronaldo his first sight of goal shortly afterwards, but it wouldn't take long before Madrid restored their aggregate advantage and levelled things up on the night.
Marcelo - himself a goalscorer in the first leg - turned provider by collecting Mateo Kovacic's crossfield pass before delivering an inch-perfect cross to the back post, where Benzema was waiting to plant a header into a largely empty net.
The equaliser saw Madrid equal Tottenham Hotspur's all-time record of scoring in 42 consecutive European home games but, for all of their attacking prowess, the hosts continued to look shaky at the back, with makeshift right-back Lucas Vazquez putting in a particularly unconvincing performance.
Bayern continually advanced into dangerous positions during a dominant spell, but they failed to make the most of them as Robert Lewandowski and Muller struggled to get the final shot away.
Madrid themselves wasted a good opportunity when Marcelo took an unnecessary touch with players queuing in the middle for a cross, but it was Bayern who were on top and Muller did finally force a save from Keylor Navas shortly after the half-hour mark with a snapshot from inside the area.
The story of the first leg was one of Bayern's missed chances, and they may have been fearing the same when they somehow failed to regain their lead in the 33rd minute, with Lewandowski's low strike being saved by Navas before Rodriguez blasted the rebound over an empty net from point-blank range.
Ronaldo had been uncharacteristically quiet up until that stage, and his only real sight of goal in the first half came with six minutes remaining when he cut inside onto his left foot before drawing a low stop from Ulreich at the near post.
The resulting corner was headed into the side-netting by Ramos as Madrid again looked to pull off a smash-and-grab late in the first half, but Tolisso's curling effort in the final minute of the opening period was another reminder for Madrid that Bayern were capable of scoring the goals they needed to progress.
Madrid themselves were fortunate to go into the break all square on the night, but their main slice of luck arrived just seconds after half time when an almost-inconceivable error from Ulreich gifted the hosts the lead after he had been sold slightly short by a Tolisso back-pass.
The Bayern keeper - who has been standing in for the injured Manuel Neuer for the majority of the season - seemed to momentarily forget the back-pass rule before trying to adjust his position from picking the ball up with his hands to kicking it clear on the slide, only to completely miss it and leave Benzema with the easiest of finishes.
Whereas one goalkeeper was left red-faced by one of the biggest howlers ever seen at this stage of the competition, the other was receiving plaudits five minutes later when Navas - who has been questioned on numerous occasions this season - pulled off a fine reaction save to keep out David Alaba's deflected effort.
Bayern then saw their third and best penalty shout turned down when Ramos bundled into Lewandowski inside the area, but Madrid's pressure soon started to grow and it took a smart piece of defending from Niklas Sule to prevent him from turning the ball into his own net from a dangerous Luka Modric cross.
The hosts had the opportunity to effectively kill the tie off moments later when Ronaldo was first prevented from reaching a Marco Asensio cross by Sule before then getting on the end of a Marcelo delivery, but the competition's top scorer blazed his half-volley over the crossbar with the Bernabeu waiting for the net to bulge.
It was a let-off for Bayern from a player who is usually so clinical in such situations, and Jupp Heynckes's side quickly tried to make the most of it with centre-backs Mats Hummels and Sule both having sights of goal in quick succession on the hour mark.
The visitors finally got their deserved equaliser just three minutes later, and it came from Madrid loanee Rodriguez of all people as he reacted quickest to the loose ball after seeing his initial effort blocked by Raphael Varane, sliding a follow-up effort under Navas from a tight angle.
Madrid had struggled to deal with crosses all evening, and that route almost provided another goal for Bayern with 15 minutes left when first Tolisso was denied by Navas and then Varane made a crucial block to prevent Rodriguez from doing any further damage against his parent club.
Muller was the next to come close via the aerial route when his header had Navas scrambling, and Bayern were given a fresh injection of hope when the fourth official indicated a minimum of five minutes added time.
In reality that turned out to be six, but still the German champions could not turn their dominance into goals with Hummels glancing a corner wide, Navas making a crucial claim in front of Lewandowski and, with the final action of the game, Muller falling just short of getting on the end of a pass into the box.
The final whistle left Bayern players in tears as their treble hopes were ended, but there were jubilant scenes amongst the Madrid contingent as they moved a step closer to making yet more history in a competition which they could now win for the fourth time in the past five seasons.
The victory will be a big boost for Madrid heading into Sunday's Clasico showdown with newly-crowned Spanish champions Barcelona at Camp Nou, while Bayern must try to pick themselves up in time for Saturday's Bundesliga match against Koln.
REAL MADRID (4-4-2): Navas; Vazquez, Varane, Ramos, Marcelo; Modric, Kovacic (Casemiro 73'), Kroos, Asensio (Nacho 88'); Benzema (Bale 72'), Ronaldo
BAYERN MUNICH (4-5-1): Ulreich; Kimmich, Sule, Hummels, Alaba; Muller, Tolisso (Wagner 75'), Thiago, Rodriguez (Martinez 84'), Ribery; Lewandowski