Enmanuel Valdez hit a tiebreaking two-run double in Boston's five-run fifth inning, and the Red Sox beat the Philadelphia Phillies 8-6 on Wednesday night.

Jarren Duran had three of Boston's 13 hits. David Hamilton had two hits, scored twice and drove in two runs.

The Red Sox, who trailed 4-0 after three innings, had dropped three of four. With the win, they returned to .500 at 34-34.

“We swung the bat well from the get-go,” Red Sox manager Alex Cora said. “Hit the ball hard, put pressure on them. Got a chance there to use (Valdez) with men on and he put a great swing on it."

Bryce Harper and Nick Castellanos each had two hits for NL East-leading Philadelphia (46-21), which had won five of six. Bryson Stott had two RBIs.

Harper and Whit Merrifield each hit an early RBI single against Nick Pivetta, and David Dahl doubled home Stott to make it 4-0 in the third.

But Jamie Westbrook drove in Rafael Devers with a sacrifice fly for Boston in the fourth, and the Red Sox went ahead for good with their big fifth inning.

Hamilton, Ceddanne Rafaela and Duran started the rally with three consecutive singles, chasing Cristopher Sánchez. Merrifield committed a throwing error on Duran’s tough chopper up the middle, and Hamilton and Rafaela scampered home on the play.

“He wasn’t mixing his pitches,” Phillies manager Rob Thomson said of Sánchez. “He was behind in the count, his command was off a little bit, velo was there. He wasn’t commanding his fastball, he wasn’t commanding his changeup. They were taking a lot of balls in the dirt.

“Could be just one of those nights. He’ll be back out there.”

Rob Refsnyder greeted José Ruiz (1-1) with another single, and Tyler O’Neill’s sacrifice fly tied it at 4. With two outs and runners on the corners, Valdez’s pinch-hit drive off the wall in left gave the Red Sox a 6-4 lead.

Boston added two more in the sixth. Bobby Dalbec reached on a leadoff walk before Hamilton drove a 1-0 fastball from Spencer Turnbull deep to right-center for his fourth homer.

Cam Booser (1-2) pitched a scoreless inning for the win, and Kenley Jansen handled the ninth for his 10th save.

The Phillies closed to 8-6 when Harper doubled, advanced on a Jansen balk and scored on Alec Bohm’s sacrifice fly. Merrifield walked with two down, but Dahl flied to right for the final out.

“I feel great,” Jansen said. “I love where I’m at right now, stuff-wise, especially with my cutter.”

Pivetta issued a season-high four walks in four innings. He allowed six hits and struck out four.

Sánchez was charged with four runs and seven hits. He struck out two and walked two.

TRAINER’S ROOM

Phillies: SS Trea Turner, who has been on the injured list since May 4 with a left hamstring strain, could be activated for the homestand that begins Monday.

Red Sox: INF/OF Romy Gonzalez, on the IL since May 31 with a left hamstring strain, is scheduled to start a rehab assignment with Triple-A Worcester on Thursday. ... OF Wilyer Abreu (right ankle sprain) is running and feels good. He may need just one rehab game and is expected to be activated when eligible.

UP NEXT

The Phillies and Red Sox wrap up their three-game series on Thursday. RHP Aaron Nola (8-2, 2.77 ERA) is scheduled to start for Philadelphia, opposed by RHP Tanner Houck (6-5, 1.91 ERA).

More From 92.9 The Ticket