Hernanes, Antonio Candreva and Miroslav Klose put Lazio firmly in the driving seat at 3-0 up, but goals from Nigel de Jong on the hour mark and a Stephan El Shaarawy strike 10 minutes later set up a grandstand finish.
However, Lazio held on to all three points, taking them up to third in the table and leaving Milan just two points above the relegation zone in 13th after a fifth defeat in eight league matches.
Milan started in attacking mode before the home side responded, taking the lead in the 25th minute with their first shot of the game.
Hernanes was given too much room to dribble towards the penalty area, and given his good recent form, that was dangerous as he showed when his shot deflected off Daniele Bonera to loop past Marco Amelia.
A minute later, Dias made a clearance which was worth a goal in itself to deny El Shaarawy, who had threaded his shot under Albano Bizzarri.
Lazio played a waiting game and struck again in the 41st minute with Candreva taking aim from over 25 yards and sending in a shot which dipped in over Amelia into the top left-hand corner.
Klose made it three early in the second half when he was picked out unmarked by Candreva's right-wing cross, and the German sent in a sidefooted volley from seven yards.
Klose was on the Germany side which threw away a four-goal lead only to draw with Sweden on Tuesday and he may have feared the same when De Jong pulled a goal back for Milan, getting the slightest of touches onto Urby Emanuelson's inswinging free-kick in the 61st minute.
El Shaarawy then picked his spot with a fine low shot from just inside the penalty area to bring Milan back to within one goal with 20 minutes remaining.
However, Lazio held on for the points to heap the pressure on Milan coach Massimiliano Allegri.