Thomas Mueller set up one goal and scored a second-half winner as Bayern Munich struggled past Freiburg 2-1 on Sunday to snap its opponent's five-game winning run and extend its lead at the top of the Bundesliga to four points.

Bayern, which conceded a goal for the 11th straight league game and was far from impressive, is now on 36 points, four ahead of RB Leipzig which drew 2-2 with VfL Wolfsburg on Saturday, and seven clear of Bayer Leverkusen and Borussia Dortmund in third and fourth places.

The Bavarians went ahead after seven minutes as Robert Lewandowski set a new league record with 21 goals from 16 matches.

READ:Dortmund rues missed penalty in 1-1 draw with lowly Mainz

Eager to bounce back from last week's 3-2 loss to Borussia Moenchengladbach, the host 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 Mueller.

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.

Mueller 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.