Denzel Dumfries and Marcelo Brozovic scored first-half goals at San Siro before Lautaro Martinez headed in a third shortly after the break to earn Inter a fourth consecutive win.
Henrikh Mkhitaryan drilled in a late consolation as Inter capped off a successful week that began with a 3-0 victory Tuesday over Milan in the second leg of their Italian Cup semifinal.
"We were really worried about this match a few days after using up a lot of energy in the derby," said Inter coach Simone Inzaghi.
"We played a great match against an opponent in good shape, strong physically and tactically. It's an important signal."
Milan could regain first place by winning at Lazio on Sunday, but Inter have a game in hand away to Bologna in midweek.
Third-placed Napoli on Sunday play an Empoli side who are winless in 16 matches since they defeated Luciano Spalletti's title challengers 1-0 in Naples on December 12.
Jose Mourinho's Roma arrived in Milan unbeaten in 12 games, a run which had given them an outside shot of qualifying for the Champions League.
They dampened Napoli's Scudetto hopes at the start of the week by snatching a last-gasp equaliser in a 1-1 draw, but Inter ensured there was no such slip-up against the man who led them to the treble in 2010.
Moments after Roma defender Gianluca Mancini powered a header narrowly wide, Hakan Calhanoglu played Dumfries through and the Dutchman finished past Rui Patricio to put Inter in front.
Croatia international Brozovic then slammed into the top corner after skipping past several defenders inside the Roma box.
Martinez rose unmarked at a corner to nod in his team-leading 16th goal this term seven minutes into the second half.
Mkhitaryan rifled in from Eldor Shomurodov's cutback five minutes from time but Roma remain five points back of Juventus in the race for fourth place.