Champions Internazionale had gone top with a convincing 3-1 win over AS Roma on Saturday -- their third league victory in a row -- putting pressure on Milan to respond in a tricky-looking trip to the capital to take on the unpredictable Lazio.
Milan had plenty of chances to equalise in the first half, firing 12 shots on Lazio's goal in the opening period, but they could not make one count.
The visitors kept coming after the break, with the pressure telling as French striker Olivier Giroud fired Milan level in the 50th minute.
Veteran striker Zlatan Ibrahimovic came off the bench in search of a winner, with the Swede turning provider for Tonali right at the death to spark wild scenes of celebration among Milan players and staff.
Come the end of the season, this may prove to be a crucial success should Milan win their first Scudetto since 2011, with Pioli's side now back top, two points clear of second-placed Inter, who have a game in hand. Lazio stay seventh on 56 points.
A jubilant Pioli heaped praise on his side, saying: "It is right to be satisfied and happy for our players who are lions.
"They get too little credit but they are proving to be very strong," he told DAZN. "There are four games to go, all of them must be won, I don't know if we will succeed but we are very strong.
"There is no team that is so young and fighting for the Scudetto. I ask the guys for a last effort, now we have to throw ourselves into the championship. Let's play the next one to the maximum, it is useless to think too far ahead."
Elsewhere in Serie A on Sunday, Salernitana, for so long bottom of Serie A, got their third successive league win -- a 2-1 victory over Fiorentina -- to move up to 18th, three points from safety.