HOUSTON — Houston’s struggles against Texas might cost the Astros a playoff spot.

Ken Giles allowed two runs in the ninth inning of the Astros’ 3-2 loss to the Rangers on Tuesday night. Giles had converted nine consecutive save opportunities.

Houston (75-70) has won just three times in 18 games against Texas this year. It is 4 1/2 games back of Toronto and Baltimore for the top spot in the wild-card standings.

“I’ve seen and been in some tough ones,” Houston manager A.J. Hinch said. “This one’s pretty hard. We had every chance to win the game and obviously strange things happen when we play these guys.”

Giles’ trouble started when Rougned Odor reached on a wild pitch after striking out with one out. He swiped second and scored on Elvis Andrus’ two-out triple. Jurickson Profar followed with a tiebreaking RBI single.

“Things didn’t go our way, go my way,” Giles said. “It’s my responsibility to shut the guys down. I didn’t do my job today. I take full responsibility for that. I didn’t make the pitches when I needed to so I’m just going to take the good from the bad and just bounce back for the guys next time.”

It was the first blown save for Giles (2-4) since June 18 against Cincinnati. Alex Claudio (4-1) pitched the eighth for the win, and Tanner Scheppers worked a perfect ninth for his first save.

“These guys play complete games across the way and we haven’t been able to solve them,” Hinch said.

Jose Altuve homered in the fourth and Jason Castro connected in the sixth, sending a drive to the upper deck in right field to give the Astros a 2-1 lead.

Adrian Beltre led off the second with his 30th homer for AL West-leading Texas (87-59). Beltre fell to a knee after swinging, but his towering shot traveled all the way to the Crawford Boxes in left.

Houston right-hander Brad Peacock allowed three hits in six innings. He retired his last 10 batters.

Texas right-hander A.J. Griffin also pitched well, striking out seven in a season-long seven innings. Griffin has allowed 26 homers this season and seven over his three September starts.

TRAINER’S ROOM

Astros: LHP Dallas Keuchel, who hasn’t pitched since Aug. 27 because of inflammation in his left shoulder, probably will not throw Wednesday, Hinch said. “We are going to go day to day and see if we can increase any type of activity, but his target date is a little gray area than anything else,” Hinch said.

WATCH YOUR STEP

On Evan Gattis’ towering popup in the fifth, Andrus came in from shortstop and walked up the back of the pitcher’s mound. As he made the catch, Andrus appeared to trip on the top of the mound and fell, but hung on to the ball.

Altuve also lost his footing during the game, but his fall did not have a good result. Altuve hit an infield single off third base in the sixth that was fielded by Andrus. Altuve made a wide turn around first and slipped in the dirt about 15 feet past first. Andrus double-pumped and then fired to first as Altuve had issues getting his footing back and was tagged out.

UP NEXT

Rangers: LHP Derek Holland (7-7) will start Wednesday instead of RHP Yu Darvish, manager Jeff Banister said following Tuesday’s game. Darvish will move behind LHP Cole Hamels in the rotation and start Saturday.

Astros: RP Joe Musgrove (2-4) will take the mound Wednesday night for the Astros looking to repeat the success he had in his last start Friday against the Cubs when he allowed two runs in six innings.