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 Vázquez, whose throwing error in the eighth put the tying run on third, led off the ninth with a ground-rule double to centre. 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 Hernández, who pinch-ran for Vázquez, 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 defence 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 Final 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 Vázquez 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 centre, 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.

WINNING

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."

TEXAS TOUGH

Rangers manager Chris Woodward had an easy time shaking off this loss. His club has won four of six and has a chance at taking three of four in the Rangers' only visit to Boston this season.

"We're in a good spot. We've been playing well, so it's fun to watch our guys compete in that kind of environment against a good team," Woodward said. "When they take it out on the field, they're fearless. We got beat today, but they had to execute some pitches to beat us and that's going to happen every once in a while."

TRAINER'S ROOM

Rangers: LHP Drew Smyly will miss his scheduled start on Friday when Texas visits Cincinnati. Woodward said he wanted to take some pressure off Smyly, who has struggled in his last two starts and will be available in the bullpen. ... LF Willie Calhoun (quadriceps strain) will start a rehab assignment with Triple-A Nashville on Thursday. ... 1B Ronald Guzmán needed few minutes after a sharp grounder caught him on the wrist in the second inning.

Red Sox: RHP Hector Velázquez (back) will start a rehab assignment Thursday or Friday, manager Alex Cora said. Velázquez 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.

UP NEXT

RHP Adrian Sampson (5-3, 3.72 ERA) starts the series finale for the Rangers on Thursday against Boston LHP David Price (4-2. 2.70).

___

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP_Sports