Moise Kean came off the bench to claim a late winner and put Juventus on the brink of clinching the Serie A title.
If Napoli lose at home to Genoa on Sunday, Juve will be Italian champions for an eighth straight season.
Although Krzysztof Piatek gave the visitors a half-time lead in Turin, Paulo Dybala levelled with a penalty.
Milan took the lead when Tiemoue Bakayoko poked through for Piatek to calmly finish from the edge of the box for his 21st Serie A goal of the season.
It was Bakayoko’s eighth in 11 league games for Milan since a 35m euro move from Genoa in January – joining Sampdoria’s Fabio Quagliarella at the top of the scoring chart.
Juve replied with Mario Mandzukic and Dybala testing Pepe Reina, before Bakayoko’s header was saved by Juve keeper Wojciech Szczesny after the break.
Moments after that save, the hosts were awarded a penalty for Mateo Musacchio’s foul on Dybala, who slammed in the spot-kick for his 10th goal of the season before being replaced by Kean.
The teenage forward then fired over from a corner but Juve kept the pressure on, with Alex Sandro and Federico Bernardeschi going close before Kean fired home from Miralem Pjanic’s pass to leave fourth-placed Milan four games without a win.