HOUSTON — Rafael Devers homered off Justin Verlander, and the Boston Red Sox took advantage of two errors by the Houston Astros to avoid a series sweep with a 4-1 victory Sunday.

Eduardo Rodriguez (5-3) held Houston to one run and four hits in six innings, improving to 5-1 in his last eight starts.

The Astros lost for just the fifth time in 22 games and finished the regular season 4-2 against the Red Sox, who beat them 4-1 in the ALCS last season on the way to a World Series championship.

Devers’ solo shot to center field in the fourth gave the Red Sox a 2-1 lead. It was Devers’ seventh homer of the season and fourth in six games.

Boston extended its lead to 3-1 following a sloppy fifth inning for the Astros’ defense. A one-out double by Eduardo Nunez was followed by errors from second baseman Yuli Gurriel and third baseman Alex Bregman on back-to-back plays, allowing Nunez to score.

Verlander (8-2) gave up three runs and six hits in seven innings, striking out six and walking none. He got his 2,800th career strikeout in the fourth against Michael Chavis and finished his day five strikeouts shy of Cy Young’s 2,806 for 21st all-time.

Verlander also threw two wild pitches, both in the third inning, after entering with none in 72 1/3 innings this season.

The Astros went up 1-0 in the first when Aledmys Diaz scored from second on a single by Carlos Correa that deflected off Devers’ glove at third base into shallow left field. Christian Vazquez couldn’t handle Nunez’s bouncing throw to the plate.

After the play, Diaz left the game with left hamstring discomfort. Gurriel moved to second base and Tyler White entered at first.

The Red Sox tied it 1-all in the second on a sacrifice fly from Andrew Benintendi that scored Steve Pearce.

Boston added an insurance run to make it 4-1 in the ninth. A walk to Jackie Bradley Jr. was followed by a balk from Framber Valdez, a passed ball and a groundout from Nunez that scored Bradley.

Marcus Walden pitched a scoreless inning for his second major league save and first this season.

Roster report

Boston recalled top pitching prospect Darwinzon Hernandez from Double-A Portland and optioned RHP Colten Brewer to Triple-A Pawtucket. Hernandez, a 22-year-old left-hander, made his major league debut April 23 against Detroit, throwing 2 1/3 innings with one walk, four strikeouts and four hits allowed.

Trainer’s room

Red Sox: LHP David Price (illness) could start Tuesday or Wednesday against Cleveland after lasting just three batters and 15 pitches before leaving Saturday’s start against Houston. . INF Brock Holt (shoulder) went through a full workout and will likely be activated and available on Monday against Cleveland.

Astros: C Max Stassi (left knee soreness) was placed on the 10-day injured list. Garrett Stubbs was recalled from Triple-A Round Rock to back up Robinson Chirinos and could make his first major league start Tuesday, manager AJ Hinch said. … 2B Jose Altuve (hamstring) was set to start a rehab assignment with Triple-A Round Rock on Sunday night.

Up next

Red Sox: RHP Rick Porcello (3-4, 4.45 ERA) will face the Indians when the Red Sox return home to Fenway Park on Monday. Boston is 6-1 in Porcello’s last seven starts. RHP Jefry Rodriguez (1-4, 4.08) goes for Cleveland.

Astros: RHP Gerrit Cole (4-5, 4.11) pitches Monday against the Cubs, looking to improve on his 9-3 career record versus Chicago and add to his MLB-leading 100 strikeouts. LHP Cole Hamels (4-0, 3.38) gets the ball for the Cubs.