ARLINGTON, Texas -- Dallas Keuchel did what aces do: stop their team's longest losing streak of the season.

Keuchel took a shutout into the sixth inning, Jose Altuve homered and the AL-leading Houston Astros ended a five-game skid and avoided a sweep by their Texas rival, beating the Rangers 2-1 on Sunday.

Carlos Beltran had a tiebreaking RBI single in the seventh. Adrian Beltre's 12th homer of the season and 3,015th career hit had pulled the Rangers even at 1 in the sixth.

Keuchel (10-2) struck out seven in 6 2/3 innings for his first win since June 2 against the Rangers, just before the lefty's nearly two-month stint on the disabled list. This was the 2015 AL Cy Young Award winner's fourth start since his second trip to the DL for neck soreness.

Keuchel had lost two in row, that skid coming after a career-best 11-game winning streak going back to last season.

It was just the third win in 12 games in August for the AL West-leading Astros.

"It's amazing how many people start freaking out when you don't have a couple good starts," Keuchel said. "The world's ending or you're not as good any more. You're a scrub. Stay the course, and that's good. That's what you've got to do if you want to last in this game."

Joey Gallo lined into an inning-ending double play with runners at second and third in the Texas eighth against Ken Giles. First baseman Yuli Gurriel caught Gallo's smash and threw to second behind Drew Robinson, who was running for Beltre.

Giles struck two in the ninth for his 23rd save.

"It's challenging to sweep a series," said Texas manager Jeff Banister, who was ejected in a wild top of the fifth. "Happy with how we played, happy with the effort. There's a lot of tremendous takeaways in this series and in this game."

Altuve's 17th home run came in the fourth off Andrew Cashner (7-9), the Houston-area native who was scratched from his previous scheduled start at the New York Mets because of neck stiffness. The right-hander went seven innings as a three-game winning streak that matched a career best came to an end.

"PUZZLING" EJECTION

Banister's ejection came while both managers had separate heated arguments following a warning when Cashner hit Marwin Gonzalez with a 3-0 pitch. Five batters were hit by pitches Saturday.

Banister was tossed by first base umpire Tripp Gibson about the time Houston manager A.J. Hinch walked away from his tense exchange with crew chief Bill Welke.

"Quite puzzling," Banister said. "Trying to have a conversation with the plate umpire and base umpire decides that he'd get engaged. Still never got a real explanation of why. Wasn't arguing any part of the warning. Just trying to get an explanation."

REST OF THE STORY

When play resumed after Banister's ejection, Texas shortstop Elvis Andrus let Beltran's popup drop, getting the force on Gonzalez at second as Beltran sped up to reach first.

Beltran was doubled off when he didn't retouch second base while retreating to first after a diving catch in the left-field corner by Delino DeShields on Derek Fisher's liner.

The final numbers in the eventful half-inning: no runs, no hits, no errors, nobody left on base.

SHORT HOPS

Gurriel set Houston's rookie record with his 31st double, most in the majors for a rookie this season. ... Beltre's homer was No. 457 of his career. He has an eight-game hitting streak. ... Alex Bregman's career-best 14-game hitting streak ended for Houston.

UP NEXT

Astros: RHP Collin McHugh (0-1, 5.32) starts the first of two at Arizona to open a four-game home-and-home interleague series with the Diamondbacks. It's McHugh's third start after missing the first 3 1/2 months with right shoulder tendinitis.

Rangers: LHP Martin Perez (6-10, 5.18) pitches the opener of a three-game home series against Detroit. He ended a season-high four-game losing streak in a 5-1 win over the New York Mets in his previous start.

---

Corrects previous versions with Beltre's homer being 3,015th career hit, not 3,014th.

---

More AP baseball: https://apnews.com/tag/MLBbaseball