Roma move into third thanks to Under and Perotti
The 20-year-old Under fired home his fourth goal in three games from a Daniele De Rossi cross to break the deadlock after 70 minutes, with Argentine Perotti tapping in a Radja Nainggolan cross in injury time.
The victory moved Roma two points ahead of Inter Milan, who can reclaim third spot with victory away to Genoa later on Saturday.
It was the third straight win for Eusebio Di Francesco's side and a boost ahead of their Champions League clash at Shakhtar Donetsk in the Ukraine next Wednesday.
"We're slowly recovering lost ground, but we mustn't make the mistake of thinking that we have done something important, when in truth we have only done our job," said Perotti, referring to Roma's slump in December and January.
"It was important that we find our form before the Champions League resumed. Apart from Juventus and Napoli, everyone is dropping points, so we had to win this game before Shakhtar Donetsk."
In an intense first half, both sides had chances to break the deadlock with in-form Turk Under shooting just wide while Roma's Brazilian goalkeeper Alisson kept out a Stipe Perica shot.
Roma were denied a penalty when the video assistant referee (VAR) ruled that a handball from Iraqi left-back Ali Adnan, returning after two months out injured, was unintentional.
Perotti came off the bench after 69 minutes with Under opening the scoring a minute later.
And Perotti sealed the victory when converting Nainggolan's cross a minute into time added on.
Massimo Oddo's Udinese stay tenth, missing the chance to pull level with Torino, who host champions Juventus on Sunday.
Leaders Napoli, who have a one-point lead on second-placed Juventus, host SPAL on Sunday.