Thomas Muller set up one goal and scored a second-half winner as Bayern Munich struggled past Freiburg 2-1 on Sunday to end their opponents' five-game winning run and extend their lead at the top of the Bundesliga to four points.
Bayern, who conceded a goal for the 11th straight league game and were far from impressive, are now on 36 points, four ahead of RB Leipzig who drew 2-2 with Wolfsburg on Saturday, and seven clear of Bayer Leverkusen and Borussia Dortmund in third and fourth places.
They went ahead after seven minutes as Robert Lewandowski set a new league record with 21 games in the opening 16 matches.
Lewandowski is chasing Gerd Muller's 40-goal record haul in one season that dates back to the 1971-72 season.
Eager to bounce back from last week's 3-2 loss to Borussia Monchengladbach, the hosts came agonisingly close to a second goal early in the second half with Lewandowski hitting the crossbar and Leon Goretzka's rebound spectacularly palmed wide by keeper Florian Muller.
Freiburg struck against the run of play from substitute Nils Petersen's first contact with the ball, a diving header at the far post in the 62nd minute for a record-extending 28th league goal as a substitute.
Muller snatched the winner in the 74th, drilling in a shot after a Leroy Sane layoff from Kingsley Coman's cross before Freiburg's Petersen rattled the crossbar with a thundering shot in stoppage time.
"It was a hard earned win," Bayern defender Jerome Boateng said. "But we need to improve. It was a nervous finale and it was our fault. But we kept fighting."
"It is about winning games. We don't have to be shine every time."