For just the second time this season and first since July 29, the right-hander went nine innings and he did it against one of the most feared lineups in baseball in hitter-friendly Camden Yards.
The first-place Red Sox (86-64) improved to 20-9 within the American League East since July 1.
Boston leads the second-place Orioles (82-68) by four games with 12 games remaining. Baltimore was a half-game ahead of Toronto for the first AL wild-card spot.
Porcello (21-4), the major league leader in wins, allowed four hits and no walks while striking out seven. He entered the game with a 1-4 record and 5.53 ERA against the Orioles in seven previous starts.
It was his third complete game of the season and seventh of his career.
"You are never going to fault a guy for being a competitor," said Boston manager John Farrell, noting Porcello had words with Baltimore's Manny Machado early in the game. "He sets the tone for us. He understands what his limitations are as a pitcher. It was a game he was in control from the start."
Porcello threw just 89 pitches, 65 for strikes.
"This is an aggressive fastball-hitting team," Farrell said of the Orioles. "He was able to locate early in the count. He is going to be around the plate."
Baltimore starter Dylan Bundy (9-6) gave up five runs and six hits in five innings. The rookie had won at Boston on Sept. 13 in his previous start.
"You have to adapt to every start," Bundy said. "You have to make adjustments every single game."
It didn't take long for the game to have an edge to it.
The Red Sox took a 2-0 lead in the third. Xander Bogaerts singled with one out and two batters later Betts homered to left on an 0-2 pitch from Bundy.
It was the 31st homer of the year for Betts, who reached base for the 32nd consecutive road game. That brought an ovation from many of the Red Sox fans at the game.
"We are having fun. That is the main thing," Betts said.
Farrell said, "Mookie sees the ball extremely well in this ballpark."
Tempers flared in the fourth when Machado was hit by a pitch by Porcello, who exchanged words with the Orioles third baseman as he walked slowly to first as both benches were warned.
Leon, the Boston catcher, said Porcello was not trying to hit Machado.
"He just missed the sinker inside," Leon said.
That hit-by-pitch came back to bite Porcello, who gave up a run-scoring double to Mark Trumbo. Machado stared back at Porcello after touching home to make it 2-1.
The Red Sox padded the lead with three runs in the fifth. Pedroia had an RBI single and Ortiz smacked a two-run homer off Bundy. That gave Ortiz seven homers this year against the Orioles and 53 in his career. It was his 35th homer of the season overall.
"It is one of the best lineups in baseball," Bundy said of the Red Sox. "They just got me tonight."
Porcello gave up a solo homer to Adam Jones in the eighth. But he buckled to get the last three outs in the ninth as closer Craig Krimbel was getting loose in the bullpen.
NOTES: Orioles RHP Kevin Gausman (8-10, 3.43 ERA) will face Boston LHP Eduardo Rodriguez (2-7, 4.98), a former Baltimore minor-leaguer, on Tuesday. ... Baltimore INF/OF Steve Pearce (right flexor mass strain) will have surgery on Wednesday in New York and is done for the season, manager Buck Showalter said Monday. "Hopefully, he's ready to go next spring," Showalter said. ... Orioles LHP Wade Miley (upper back cramps), who was lifted after four innings Sunday against Tampa Bay in a 2-1 win, threw on the side Monday and felt much better, said Showalter, who did not say when Miley could pitch again. ... Boston RHP Steven Wright (right shoulder injury) has begun a throwing program in Fort Myers, Fla., and could throw off a mound at a later date, according to manager John Farrell. ... The Orioles extended their player-development contract with short-season Class A Aberdeen, a team owned by Cal Ripken Jr.