Arjen Robben, Arturo Vidal, Franck Ribery and Joshua Kimmich sealed a 25th win of the season for the champions and ensured they went a whole league campaign without defeat at the Allianz Arena for the first time since 2008.
The match was largely a tribute act to club captain Lahm and Alonso, however, who played their final matches before retiring from respective glittering careers.
Past greats of the club were presented to the crowd prior to kick-off before Lahm, ahead of his 517th appearance for Bayern, was granted a special tribute involving flowers, a golf bag and a mosaic in the stands with the message 'from a child of our own to a legend of our club'.
It was Alonso who produced the first telling contribution of the two, however, setting up Robben to cut in from the right and rifle home.
Freiburg still had a top-five finish up for grabs and missed good chances through Mike Frantz, Janik Haberer and Nils Petersen before Vidal struck 17 minutes from time.
Former Bayern man Petersen struck his 19th Bundesliga goal as a substitute to set a new record, but Carlo Ancelotti's side were not to be denied as Alonso and Lahm were replaced in the closing stages to a rapturous reception before Ribery bundled home a stoppage-time third and Kimmich - tipped to be either retiring great's heir in the team - nodded in to round off the party.
Bayern, sporting their new home kit, started like a team eager to mark the occasion with a result to match and they took the lead with only four minutes on the clock.
Robben was allowed time to move into the penalty area from the right and his left-foot shot looked to take a slight deflection as it flew beyond Alexander Schwolow and into the far corner.
Thomas Muller forced Schwolow into another good low save before Robert Lewandowski found the net, only to be flagged offside.
Freiburg had scarcely threatened in the first 25 minutes but Bayern keeper Tom Starke – whose retirement has slipped under the radar amid the tributes to Lahm and Alonso – produced a superb one-handed save to keep out a deflected effort from Frantz.
Haberer then sliced a glorious chance wide of the left-hand post from six yards before Vincenzo Grifo tested Starke from close range, and Lewandowski was promptly denied by Schwolow on the break as the match suddenly opened up.
There was a lengthy delay to the start of the second period, with officials bizarrely struggling to dismantle the temporary stage that had been set up for Anastacia's half-time performance, but Bayern looked as slick as ever as Lewandowski forced Schwolow into a brilliant reaction stop within a minute of the whistle.
Starke clawed away a bouncing half-volley from Florian Niederlechner in one of Freiburg's better spells and Bayern thought they had snatched a second through Muller on the break only for Lahm to have strayed offside before setting him up.
Robben smacked the crossbar from 20 yards but Starke was again called upon to preserve Bayern's lead, saving twice from former team-mate Petersen as Freiburg chased the equaliser that would have lifted them back into the Europa League spots - they will now be supporting Borussia Dortmund in the DFB-Pokal in order to qualify.
And their attacking efforts ultimately cost them as Vidal made it 2-0 with a stylish finish, sweeping a disguised finish into the bottom-right corner from the edge of the area after Robben teed him up.
Starke was denied a clean sheet on his final outing as Petersen halved the deficit three minutes later to surpass Alexander Zickler as the Bundesliga's most deadly substitute.
But Bayern made the win secure in injury time, Robben bursting into the Freiburg half on the break before squaring for Ribery to bundle the ball in via post and goalkeeper, before Kimmich added a fourth with the last touch of the match.
KEY OPTA STATS
- It was the first Bundesliga match with 50+ shots since detailed data collection began in 2004/05 (52 shots, Bayern: 33, Freiburg: 19).
- Philipp Lahm played his 517th and last competitive match for FC Bayern München (16 goals). In his time with the Bavarians, he stood on the pitch with 100 different players.
- Xabi Alonso assisted a goal in each of the last 2 games, on the first 32 matchdays he didn’t assist a goal.
- For the first time since February 2015, Arjen Robben scored in 4 Bundesliga matches.
- With 82 points, Bayern played the fourth-best season in Bundesliga history, only the Bavarians themselves beat this in the 2012/13, 2013/14 and 2015/16 seasons.