Piotr Zielinski opened after just seven minutes in the Stadio San Paulo for Napoli with Algerian Adam Ounas adding a stunning second from a distance in the first half before Milik's second half double.
Carlo Ancelotti's side consolidated second place and replied to Juventus who had pulled 11 points clear on Friday with a 1-0 win over Inter Milan, who are third six points adrift of Napoli.
"Games like today have all the ingredients of a trap, especially ahead of a Champions League game," said the former Chelsea boss Ancelotti.
"We can start thinking about Liverpool now."
Goalkeeper Alex Meret got his first start after breaking his arm following his summer move from Udinese, with midfielder Amin Younes also making his debut off the bench.
Algerian international Faouzi Ghoulam played for the first time in over a year after suffering a knee injury, and provided the assists for both Milik's goals.
Poland's Zielinski opened from an angle early for his third goal this season, with Ounas doubling their advantage with a searing drive five minutes before the break.
Napoli squandered chances for a third with a Milik volley deflected wide and Ghoulam sending over when alone of front of goal.
But Milik headed in the third on 68 minutes off a Ghoulam corner with the Algerian defender setting up the Polish striker's seventh goal this season five minutes from time.
But amid chaos in Sardinia, Roma, who had led with first half goals from Bryan Cristante and Aleksandar Kolarov, were caught in the last ten minutes with two late goals from Cagliari.
"I'm really angry and upset at this draw, because it's just absurd. You can't let it happen, conceding an equaliser against nine men in stoppages," said under-pressure Roma coach Eusebio Di Francesco.
Roma are already through to the Champions League last 16 before next week's game against Viktoria Plzen in the Czech Republic.
But they have a long injury list with captain Daniele De Rossi sidelined along with Edin Dzeko, Stephan El Shaarawy and Lorenzo Pellegrini.
Cristante opened after 14 minutes off a Justin Kluivert cross, as Kolarov got the second five minutes before the break off a free kick which took a big deflection off Alberto Cerri.
But the hosts broke through late when Joao Pedro nodded a corner on to Artur Ionita who blasted into the Roma goal four minutes from time.
Roma were still ahead going into injury time when Luca Ceppitelli and Darijo Srna sent off for arguing with the referee, and Cagliari coach Roberto Maran also banished.
Marco Sau nevertheless completed the hosts' comeback off an Ionita cross five mintues into injury time to maintain Caglairi's unbeaten home record.
The Sardinians are currently in 13th position.
Di Francesco's Roma, who were third last season, remain seventh, 22 points behind leaders Juventus.