Making the most of a one-day stay in Baltimore, the Phillies got 12 hits off Kevin Gausman (4-7) while building a 5-0 lead against the team with the worst record in the majors.
Alfaro, the No. 9 hitter, singled and scored in the third inning, hit a two-run double in the fourth and led off the fifth with his sixth home run.
Homers by Trey Mancini and Jace Peterson brought the Orioles within a run, but Philadelphia held on to move a half-game ahead of second-place Atlanta in the NL East.
The game was the makeup of a May 15 rainout, originally the opener of a two-game series. On May 16, Pivetta allowed two hits and struck out 11 over seven innings.
This time, the 6-foot-5 righty had a no-hitter through four innings and finished with seven strikeouts. Pivetta (6-7) gave up three runs and five hits before being pulled with two outs in the seventh.
Seranthony Rodriguez worked the ninth for his ninth save.
Gausman yielded a single to Cesar Hernandez to open the game, and the hits kept on coming for the Phillies. Gausman allowed a career-high 12 hits over five-plus innings.
Baltimore used some slick fielding to avoid falling behind in the second inning. After Scott Kingery hit a two-out double, third baseman Tim Beckham dived over the foul line to snare a grounder by Aaron Altherr, scrambled to his feet and threw out the runner.
The Phillies arrived in Baltimore around 3 a.m. after losing to the Mets on Wednesday night. After facing the Orioles, they were to fly to Miami for a Friday night game.
''It's part of being in the major leagues,'' manager Gabe Kapler said. ''Who can manage those challenging road trips best.''
Baltimore, on the other hand, merely added a game to a homestand that started Monday and ends Sunday.
''It fit well for us,'' manager Buck Showalter said.
Orioles: RHP Andrew Cashner (neck spasms) is expected to resume throwing this week. ''I feel confident that he'll make his in-rotation start after the (All-Star) break,'' Showalter said. ... RHP Darren O'Day underwent season-ending surgery on his left hamstring Thursday. ''Everything went good. No surprises,'' Showalter said.
Kapler told Rhys Hoskins to do more than simply take his cuts when he makes his first appearance in the annual Home Run Derby contest on Monday night.
''The opportunity to listen,'' Kapler said. ''For me, if I was putting myself in Rhys' shoes, just kind of hanging around the cage, listening to exceptional hitters, some of the best players in baseball, talk.''
Phillies: Jake Arrieta (6-6, 3.47 ERA) opens against the Marlins on Friday. He picked up his first win since May 29 in his last outing against the Pirates.
Orioles: Alex Cobb (2-11, 6.67 ERA) starts the opener Friday against Texas. He allowed five runs and seven hits in his last start against the Twins before departing in the sixth inning with a blister on his right index finger.
More AP baseball: https://apnews.com/tag/MLBbaseball