ARLINGTON, Texas — Yu Darvish just never got into a rhythm and the AL-best Texas Rangers never got into the lead to end what otherwise was a very successful homestand.

Darvish allowed the first three Houston batters in the game to reach base, including George Springer’s leadoff homer, and the Astros held on for a 7-6 victory Sunday to avoid a series sweep and end the Rangers’ seven-game winning streak.

“I feel these guys are in a good place right now, very confident,” manager Jeff Banister said. “They’re going to continue to play hard.”

The Rangers went 8-2 during the homestand that included four games against AL Central-leading Cleveland before taking on Seattle and Houston, their closest competitors in the AL West. They still have a 9 1/2-game division lead over the Astros with 25 games left in the regular season.

“We’re feeling good for sure. We’re in the driver’s seat right now,” said shortstop Elvis Andrus, who had the day off. “We can’t take anything for granted. There’s a lot of baseball ahead and we have to keep grinding.”

Rougned Odor had three hits and drove in three runs, including his 29th homer and an RBI single. The feisty second baseman has homered in four of the last five games, finishing with six homers and 17 homers on the homestand.

Houston had a 5-0 lead when Darvish (5-4) came off the mound to end the fourth in his shortest out this season. The right-hander from Japan struck out four, walked three and had two wild pitches.

“His command was not where it had been previously. … Worked from behind the hitters and really couldn’t get it in the soft contact zones,” Banister said. “So (he) looked a little out of rhythm in my opinion. Just very uncharacteristic.”

Chris Devenski (3-4) pitched 1 2/3 scoreless innings after taking over for starter Collin McHugh with one out in bottom of the fifth when Texas still had a runner on base and had already scored three runs in the inning to get within 6-5.

Ken Giles pitched the ninth for his eighth save in 11 chances, the final out coming when the right-hander struck out Odor.

After the fast start, going ahead 2-0 in the first against Darvish, the Astros had their first four batters reach base in the fourth and scored three more times.

“Got him out of the game and got into their bullpen and fortunate enough to come out of here with a win,” said Alex Bregman, the Astros rookie that had three hits. “That’s what you have to do against good teams like this, get ahead of them early and continue to apply pressure.”

BRUISED AND BLEEDING

Rangers LF Carlos Gomez had blood streaming down his face after getting cut by his own helmet when sliding headfirst into second base on a stolen base in the sixth inning. The helmet popped off, bounced off the ground and into his face. A trainer came out and looked at Gomez, who then disappeared briefly into the dugout before returning with two bandages — one on the bridge of his nose, and another over the top corner of his left eye. A few pitches later, he was picked off second base.

SHORT HOPS

Evan Gattis also homered for the Astros. He struck out in each of his other four at-bats. … Ian Desmond and Carlos Beltran had consecutive RBI doubles in the Rangers fifth before Odor’s run-scoring single chased McHugh. … Odor had his 20th error of the season, when the ball hit off the side of his glove in the sixth after SS Jurickson Profar made a diving play to his left, and flipped the ball to him while still flat on the ground.

TRAINER’S ROOM

Rangers: C Jonathan Lucroy was back in the lineup and not feeling any lingering issues from flu-like symptoms that kept him to miss Saturday’s game. … RHP Keone Kela said he was OK after a liner deflected off the palm of his right hand in Saturday’s game.

UP NEXT

Astros: Continue their stretch of 13 consecutive games against division leaders. They open a four-game series Monday at AL Central leader Cleveland.

Rangers: Open a 10-game road trip when they will face three AL West rivals before playing 12 of their last 15 games at home. The trip starts Monday in Seattle, and ends the following week with three games in Houston.