Rafael Benitez's men started their 15th match of the campaign looking to build on last week's 4-2 away win at Lazio, which came on the back of two consecutive defeats.
However, despite dominating Francesco Guidolin's visitors in both halves, they failed to capitalise on their share of chances and paid the price in the 80th minute when Basta bundled home in a busy six-yard box.
Napoli's second draw means they remain third but are now eight points adrift of Juventus, 2-0 winners at Bologna on Friday, and two adrift of Roma, who entertain Fiorentina early on Sunday.
Goran Pandev had given the hosts the lead by the 41st minute, the Macedonian coolly controlling Federico Fernandez's header back into play from a corner to beat Zeljko Brkic in the Udinese goal on 38 minutes.
Pandev grabbed his second only three minutes later after collecting Gonzalo Higuain's cut-back from the byline and spinning the other way to beat Zeljko at his far post with a curling left-foot shot.
Udinese, who beat Fiorentina two weeks ago and were unlucky not to take a draw from a 1-0 defeat away to Juventus last week, did well to keep their composure and were rewarded just before the interval.
A corner found the head of Thomas Heurtaux, and his effort came off the head of Fernandez and past Rafael Cabral, standing in for Pepe Reina in the Napoli net.
Napoli's defence was then at fault for backing off in the 70th minute when Bruno Fernandes pounced on a mistake by Gokhan Inler and was allowed to stride forward and send a weighted lob over the head of Cabral.
If Napoli were stunned, they did not show it.
Only a minute later Higuain collected Pandev's ball on the left and although his angled strike was pushed out by Zeljko, Blerim Dzemaili was on hand to bundle the loose ball home for a 3-2 lead.
Balotelli had opened the scoring in the eighth minute with a fortuitous flick at the back post following Kaka's inviting ball across the face of goal.
Livorno, the home town of Massimiliano Allegri, were in no mood to honour the Milan coach's 200th game in Serie A and equalised on 26 minutes when Luca Siligardi fired in a fierce curler to beat Milan 'keeper Gabriel.
Milan's defence had been guilty of leaving space at the back all too often and when Paulinho collected a weighted through-ball from midfield the striker outpaced Cristian Zapata with ease to beat Gabriel at his near post in the 58th minute.
Livorno's hopes of holding on for their first win against Milan since January 2005 were kept in check when a Balotelli free-kick from 25 metres left 'keeper Francesco Bardi with no chance in the Livorno net with seven minutes to play.
Balotelli almost grabbed a third two minutes from time but the striker saw a stunning, looping drive smack off the crossbar with Bardi beaten.