Robert Lewandowski, who scored Bayern's equalizer after Freiburg shocked the visitors by taking a third-minute lead, missed a great injury-time chance and Leon Goretzka then struck the post for Bayern.
The end of Bayern's six-game winning run in the league allowed Dortmund to seize the lead by two points ahead of the sides' potentially league-deciding clash in Munich next weekend.
"We have to win to stay in the race, which is annoying because we had done so well to catch up," said Bayern coach Niko Kovac, whose side was trailing by nine points earlier in the season.
Dortmund went into what was sure to be a tough game without its best player, Marco Reus, who was excused so he could be with his partner for the birth of their first child.
Freiburg was without top scorer Nils Petersen due to a thigh problem, yet still managed to grab an early lead through Lucas Hoeler. The Freiburg forward also scored the equalizer in the sides' 1-1 draw on Nov. 3.
Lewandowski equalized acrobatically in the 22nd.
With defender Abdou Diallo going off injured early in the second half and his replacement, Achraf Hakimi, following him off some 20 minutes later, it was shaping up to be a frustrating afternoon for Dortmund.
Then Alcacer fired a free kick through the wall and Sancho set up the Spaniard for his second.
GLADBACH IN DANGER
Borussia Moenchengladbach is in danger of losing its hold on fourth place and the last qualification spot for the Champions League after losing the derby with Fortuna Duesseldorf 3-1. The visitors were rocked by three early goals, all set up by Benito Raman in a 10-minute spell.
Gladbach has won only one of its last seven league games, and Eintracht Frankfurt can move to fourth win a win over Stuttgart on Sunday.
Nuremberg rekindled hopes of escaping relegation by beating Augsburg 3-0 at home to end its 20-game run without a win.
Yussuf Poulsen scored a hat trick as Leipzig routed Hertha Berlin 5-0 in the late game to consolidate third.