Second-placed Roma were also helped by an outstanding display from goalkeeper Morgan De Sanctis as they stayed three points clear of third-placed Napoli, who rode their luck to beat Torino 1-0 with a controversial late goal by Gonzalo Higuain.
Roma made only a small dent in Juventus' lead as the champions stayed 14 clear points clear at the top and on course for a third successive title following their 1-0 win at Genoa on Sunday.
But it was an important win in the battle for a Champions League place, with only the top two going directly into the group stage. A third place finish earns a place in the two-leg final qualifying round.
One club-man Totti, in remarkable 22nd season at Roma, is still hugely influential and his side had failed to score in their last two games without him.
The 37-year-old put them ahead in the 22nd minute when he fired in a rebound from 12 metres for his sixth goal of the campaign after Udinese's teenage goalkeeper Simone Scuffet parried Gervinho's shot.
Roma went further ahead after half an hour with a lethal counter-attack.
Totti released Gervinho with a raking diagonal ball and the Ivorian showed superb control as he controlled the pass, beat his marker and flicked the ball inside for Mattia Destro to add the second.
De Sanctis, who had already denied Emmanuel Badu, then made a brilliant one-handed stop to turn away a goalbound shot from Antonio Di Natale, earning him a congratulatory pat from the Udinese striker.
Giampiero Pinzi pulled one back six minutes after the re-start before Greek international Vassilis Torosidis restored Roma's two-goal lead with a low shot from the edge of the area.
Dusan Basta made it a nervous final 10 minutes for Roma when he hooked home after another De Sanctis save.
"Not playing was difficult but the important thing tonight was to win and maintain the pace. We have Napoli on our heels," Totti told Sky Sport Italia.
"De Sanctis produced some great saves tonight. He has so much experience and directs the defence so he is a goalkeeper who makes a difference."
Napoli survived two shots against the woodwork before Higuain got clear of Kamil Glik and fired his shot past Daniele Padelli in the 90th minute.
The furious hosts claimed that Higuain had tripped Glik but the referee allowed the goal to stand.
Midtable Torino had plenty of chances and Cesare Bovo smashed a 25-metre shot against the post just before the half hour with Pepe Reina well beaten.
Riccardo Meggiorini also hit the post with only Reina to beat after he sprung the offside trap as Torino slumped to their fourth successive defeat without scoring.
Ciro Immobile, dropped from the Torino starting line-up, forced Reina to save with his legs after coming on and then fired over from 12 metres when it seemed easier to score after Jasmin Kurtic dispossessed Valon Behrami and rolled the ball to him.
- Sports & Recreation
- Morgan De Sanctis
- Gonzalo Higuain