Massimiliano Allegri claimed he "fell asleep" during Juventus' dramatic 2-1 Serie A win over Napoli – making an error that almost cost the runaway leaders victory.

The effects of a contest featuring two red cards and a missed penalty upon a raucous Stadio San Paolo crowd were anything but sedentary.

Miralem Pjanic opened the scoring with a sublime free-kick after Napoli goalkeeper Alex Meret was dismissed for a professional foul on Cristiano Ronaldo.

Emre Can doubled the visitors' advantage before half-time but Pjanic went from hero to villain as he collected a second yellow card for handball early in the second half.

Lorenzo Insigne crossed brilliantly for Jose Callejon to reduce the arrears but smashed an 84th-minute spot kick against the post as Juventus took another step towards an unbeaten Serie A season and increased their advantage at the summit to 16 points.

Speaking to Sky Sport after the match, Allegri lambasted himself for not taking Pjanic out of the firing line following his initial caution for a foul on Callejon.

"I fell asleep, I should have subbed him off after the first yellow," he said.

"The second caution for Pjanic made us lose control. We let Napoli back into the match and the stadium started believing again, even if we had a great opportunity at 2-1 that we wasted.

"Sixteen is an important margin but we need to wait for the maths [to guarantee the title].

"Now, let's rest and then head to Udinese and Atletico [Madrid]. We could have done better."

Despite some replays suggesting contact between Meret and Ronado was minimal, Allegri had no doubt the officials made the right decision in that instance.

"As people have told me, in this case it was a foul," he added.

"The intent was clearly there so I think it was a good decision. I think the referee did well overall."