Xander Bogaerts, J.D. Martinez and Christian Vázquez each had an RBI double that helped the slumping Red Sox beat the Milwaukee Brewers 7-2 Sunday for just their fourth victory in 17 games as the trade deadline approached.

Bogaerts, Martinez and Vázquez all are in what could be in their final season with the Red Sox. Bogaerts can opt out of his contract and the other two are eligible to become free agents.

Boston, which had a season-high eight doubles, was 3-7 on a season-long homestand and 8-19 in July.

Ex Red Sox outfielder Hunter Renfroe hit a two-run homer over the Green Monster for the second straight day and went 4 for 4 for NL Central-leading Milwaukee, which lost for only the second time in nine games since the All-Star break.

Josh Winckowski (4-5) allowed two runs and seven hits in five innings, becoming Boston's first starter to win in 30 games - the majors' longest streak since the Mariners went 33 games in 1979.

Trailing 2-0, Boston struck with five unearned runs in the fifth against Aaron Ashby (2-9) on consecutive two-out RBI doubles by Bogaerts, Martinez, Vázquez and Alex Verdugo. Bogaerts drove in two runs with a drive down the left-field line. Verdugo's hit was off Hoby Milner.

The inning was extended because second baseman Kolten Wong dropped shortstop Willy Adames' throw on an attempted force play.

The Red Sox added two more runs in the sixth when Jackie Bradley Jr. had an RBI double and scored on Jaylin Davis' single.

Renfroe hit his 19th homer. He hit 31 last year in his only season with Boston and was dealt to the Brewers in November.

KEEPING IT REAL

Despite his team's struggles, Red Sox manager Alex Cora feels he's fortunate to be back in baseball after being suspended for the 2020 season for his part in the Astros' 2017 cheating scandal while he was their bench coach.

"I was in a deeper hole two years ago and I promised myself if I get back to the business, I was going enjoy it until somebody says you've got to go home," he said before the game. "I put myself in that situation in 2020, got suspended for what we did in 2017 and paid the price. I'm lucky enough that this organization gave me a chance to come back and I'm going to enjoy every day."

IT WORKED

Cora shifted his batting order, moving Davis to the leadoff spot and Bogaerts to the 2-hole in front of Martinez, with Vázquez cleanup.

TRAINER'S ROOM

Brewers: 3B Luis Urías got hit on the back of the left hand by a 92.9 mph pitch from Winckowski but he stayed in.

Red Sox: Reliever Garrett Whitlock got hit off the back of the right leg on a grounder from Urías but remained in after throwing a few warmups. . Cora said that All-Star 3B Rafael Devers (injured list, right hamstring) is expected to be in the lineup Tuesday.

UP NEXT

Brewers: Open a three-game series at Pittsburgh on Tuesday when RHP Corbin Burnes (8-4, 2.31 ERA) is slated to start.

Red Sox: RHP Nathan Eovaldi (4-3, 4.43) is scheduled to start for Boston on Monday when it begins a three-game series at Houston. RHP Luis Garcia (8-6, 3.81) is set for the Astros.