The Phillies rolled nothing but sevens during their four-game series with the Arizona Diamondbacks and came out of it winning their last three contests.

After scoring seven runs in each of the first three games, the Phillies matched that figure once again on Sunday and defeated the Diamondbacks, 7-4, to take the final three games of the series at Citizens Bank Park and give them some momentum as they embark on a nine-game road trip beginning Monday in Washington. They remained 4 1/2 games behind the NL East-leading Atlanta Braves, who beat San Francisco 9-0.

Since July 1, the Phillies are 21-3 when they score five or more runs, including 14 wins in their last 15. The only loss in that stretch came Thursday night when they scored five runs in the ninth but fell short in Arizona’s 8-7 victory.

In their nine games before Thursday, the Phils had averaged 3.2 runs per game.

“I think our pitching’s been pretty good, I do,” manager Joe Girardi said. “But I think the key there is five runs … because we’ve lost some 3-to-2′s and 2-to-1′s and that sort of thing, so I think consistent offense is a big thing for us.”

Of course, that task is made harder with the loss of first baseman Rhys Hoskins, who will have season-ending surgery to repair a tear in his lower abdomen.

One of the major contributions came from Freddy Galvis, who had been 1-for-11 at the plate in his second stint as a Phillie but drove in three runs Sunday. The big blow came in the fifth when he served a soft line drive to center that fell in and scored Bryce Harper and Andrew McCutchen to make the score 5-1.

“It was really good,” Galvis said. “I tried to stay short to the ball. I’m glad it happened.

“The team did a really good job. The offense was pretty good today and we had some pretty good pitching and defense, too. I think we played really good as a team.”

Galvis also played a role in the Phillies’ two-run first inning off Arizona starter Madison Bumgarner. After McCutchen singled home Jean Segura with the initial run, Galvis lifted a sacrifice fly to center that scored J.T. Realmuto.

When the Diamondbacks cut the lead to 5-4 in the eighth, the Phillies answered with back-to-back RBI triples from Rafael Marchán and Travis Jankowski to get to that magical seven-run mark.

“You’ve got to get other people to step up,” Girardi said. “Freddy had a good day. Marchán had a good day. You just need those types of things to happen. Jean had a good day and so did Harp, but you need those things to happen where other guys help.”

The Ranger

After setting career highs for innings (6 2/3), strikeouts (seven) and pitches (99) while allowing just one run last Tuesday against Tampa Bay, left-hander Ranger Suárez again was effective, allowing five hits and one run in 5 1/3 innings of work with five strikeouts and 95 pitches.

One of his better pitches was a slider he’d been working on.

“I’ve been throwing that pitch in the bullpen and today I felt like I had more command of it, more control of it, so I used it more,” Suárez said through an interpreter.

He gave up a run on three hits in the second, but limited the Diamondbacks to one baserunner in the next three innings, none of whom advanced past first. He was lifted after walking Christian Walker in the sixth, but J.D. Hammer got the last two outs.

Suárez, who entered the game with a 1.46 earned run average, third-lowest of any major league pitcher with at least 60 innings of work, ended it with a 1.48 ERA.

Who’s on first?

Realmuto started at first base for the first time this season, his 10th game of the year at that position, but he left the game following the fifth inning with left ankle soreness. Brad Miller replaced him at first.

The initial indication was that Realmuto, who went 1-for-2 with a walk and a run scored, had fouled a ball off his foot while batting in the fifth. But Girardi said he thought it was Realmuto’s final swing “where his ankle kind of rolled.”

“He’s day to day,” the manager said. “I’ll see [Monday] how he feels, but right now we’re considering him day to day and that’s what he’s calling it.”