BOSTON — Mookie Betts watched patiently as four straight pitches missed the strike zone, and the Red Sox averted disaster.

Betts drew a bases-loaded walk from reliever Jesse Chavez in the ninth, giving the Red Sox a 4-3 win over the Texas Rangers on Wednesday and halting Boston’s three-game skid.

“I was pretty confident knowing the situation that he had to kind of come to me at that point. He was in trouble,” Betts said. “It’s huge. It’s kind of tough because obviously we didn’t want to let them back in the game right there.”

Boston rallied against Chavez (2-1) in the ninth after allowing the Rangers to tie it in the eighth on an unearned run.

Andrew Benintendi hit a triple and two doubles, driving in two runs for the Red Sox as they avoided falling below .500 for the first time in more than a month.

Christian Vazquez, whose throwing error in the eighth put the tying run on third, led off the ninth with a ground-rule double to center. Jackie Bradley Jr. followed with a single and the Rangers walked Michael Chavis to load the bases for Betts, who fouled off the first pitch he saw from Chavez. The next four pitches were balls, and Marco Hernandez, who pinch ran for Vazquez, trotted home.

“I was just missing by a little bit. I think I was trying to be too fine in that situation where I don’t know why I should,” said Chavez, whose scoreless streak of 22 2/3 innings came to an end. “Just let them put the ball on the ground and let the defense do the work. Today was a day when I wasn’t able to do it in a situation when we needed it, for sure.”

The start of the game was moved up three hours to 4:05 p.m. to avoid overlapping with Game 7 of the Stanley Cup finals between the Boston Bruins and St. Louis Blues. Chants of “We want the Cup!” rang out from the stands throughout the game.

Matt Barnes (3-1) pitched a scoreless ninth. Starter Rick Porcello was in position for the win until Texas tied it in the eighth.

Brandon Workman hit Shin-Soo Choo with a pitch and went to third when Vazquez fielded a bunt by Delino DeShields and threw wildly. Elvis Andrus tied it with a sacrifice fly to right.

The Rangers had three consecutive hits with two outs in the first, taking a 2-0 lead on Hunter Pence’s double to center, then went without a baserunner until the sixth. Porcello retired 13 straight batters before Andrus’ two-out double in the sixth.

Porcello allowed two runs on five hits in 6 2/3 innings.

“This was a game I think everybody knew we needed to win,” Benintendi said. “Rick went out there and after that first inning, threw the ball really well and gave us a shot to win. Yeah, this is a big win so hopefully we can build off it.”

Benintendi, ejected Tuesday night for shouting at umpire Angel Hernandez about a called strike, doubled and scored in the first. He hit an RBI triple in the third, tying it at 2-2, and drove in a run with a double in the fifth.

Starter Lance Lynn worked six innings for the Rangers, allowing three runs on six hits. He walked one and struck out eight.

The Red Sox, who only a few days before were trying to climb five games above .500, improved to 35-34. Boston hasn’t had a losing record since May 7, when it beat Baltimore to move to 19-19.

The World Series champion Red Sox haven’t been more than four games above .500 so far this season.

“I’ve been saying the goal is to get to five over,” Manager Alex Cora said. “We need to get there, and I say sooner rather than later and it’s getting, like, later. But we’ve still got time to do that.”

NOTES:  RHP Hector Velazquez (back) will start a rehab assignment Thursday or Friday, Cora said. Velazquez has been on the injured list since May 30 … LHP Brian Johnson (left elbow inflammation) will travel with the club this weekend for a three-game series at Baltimore. Johnson, on the injured list since April 6, could pitch some relief or possibly start Sunday, Cora said.

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.