BOSTON — Everyone in the Boston Red Sox’s lineup is hitting these days.

Even Ryan Hanigan.

The backup catcher was batting just .149 (7-for-47) and had driven in four runs all season before a three-hit, four-RBI afternoon in Boston’s 10-9 win against the Houston Astros on Sunday.

“We’re getting contributions up and down the lineup, and it’s fun to be a part of right now,” Red Sox manager John Farrell said after his team completed a 6-1 homestand.

The Red Sox (24-14) scored a combined 73 runs during that stretch and totaled 10-plus hits in each of their past eight games, including 10 more Sunday.

Boston has hit at least one home run in 16 consecutive games, its longest streak since a 19-game run from July 4-25, 1996.

Xander Bogaerts hit a three-run home run Sunday. Hanley Ramirez and Josh Rutledge each had three hits.

Jackie Bradley Jr. extended his career-high and major-league-leading hitting streak to 21 games with a single in the fifth. Bogaerts also pushed his hitting streak to 10 games.

Rutledge filled in at third for Travis Shaw, who moved over to first as Ramirez manned the designated hitter spot with David Ortiz resting.

“Anytime you can go to your bench and step in, and we don’t seemingly skip a beat, I think it says a lot about the depth of a roster,” Farrell said.

Boston starter Sean O’Sullivan lasted just 4 1/3 innings, giving up six runs (five earned) on five hits and two walks while striking out three in a no-decision.

The Red Sox won both games O’Sullivan started during the homestand. His reward? He was designated for assignment after the game.

“I didn’t know (before the game), but I had a pretty good idea,” O’Sullivan said of the move.

“I had more fun playing these last two weeks in this clubhouse than anywhere else in the big leagues,” added O’Sullivan, who last won consecutive starts from Sept. 23-28, 2010, as a member of the Kansas City Royals, whom the Red Sox face in a three-game series starting Monday.

Heath Hembree (2-0) earned the win in relief, and Craig Kimbrel pitched a scoreless ninth for his 10th save.

Luis Valbuena belted a three-run home run and had five RBIs, and Carlos Correa added a solo home run for Houston. Colby Rasmus and Tyler White also had RBIs.

The Astros (15-24) won only once in the four-game series at Boston.

“We got beat,” Astros manager A.J. Hinch said. “We didn’t play well enough to win four games.”

Astros starter Chris Devenski couldn’t earn his first major league win, taking a no-decision after allowing six runs on five hits and two walks while fanning one in just two innings.

The rookie hadn’t allowed more than two runs through any of his first three starts.

Scott Feldman (2-3) took the loss after giving up two runs in the seventh inning.

Boston did most of its damage early, scoring eight runs in the first three innings.

Mookie Betts scored on a throwing error, and Ramirez got an RBI on a line-drive double in Boston’s two-run first.

Valbuena turned the tables in the second with his blast, putting Houston up by a run.

Hanigan’s single in the bottom of the frame tied it, and Bogaerts’ three-run bomb three at-bats later spotted Boston a 6-3 advantage.

Correa homered in the fourth to bring the Astros within two, but Hanigan drove in two more with a single to make it a four-run game.

Valbuena’s ground-rule double in the fifth cut the lead to two. Jose Altuve stole two bases before scoring on an error in the sixth, and Rasmus’ double tied it.

White’s RBI single an at-bat later gave the lead back to Houston.

Hanigan’s third run-scoring single knotted the score in the seventh before Betts tripled him home for Boston’s final run.

“We had another win within a few outs,” said Hinch, whose team led Boston 5-4 entering the bottom of the ninth Saturday before losing 6-5 in 11 innings. “You’ve got to play 27 outs. You’ve got to finish games.”

Boston’s Brock Holt was ejected in the seventh inning for arguing balls and strikes after he struck out looking.

“I think he said something (plate umpire) Joe West didn’t appreciate,” Farrell said.