Matt Olson hit a two-run homer to back a solid start by Homer Bailey and the Athletics beat the Astros 3-2 to take over the AL wild-card lead.
Oakland shook off a 15-0 loss in the opener of this four-game series to win three in a row, beating Cy Young Award front-runner Justin Verlander in the finale.
The A's moved a half-game ahead of Tampa Bay atop the AL wild-card standings. Cleveland is one game behind Oakland.
''We played well against them at our place and this is probably the toughest place in the American League to play,'' manager Bob Melvin said. ''To be able to come in and take three out of four and do it in different fashions every night, yeah, it felt good.''
The Athletics got Verlander (18-6) for three runs in the first three innings before he settled in to pitch three scoreless frames.
Bailey (13-8) yielded three hits and one run in 5 1/3 innings to win his fourth straight decision. He matched his career high in wins set in 2012 with Cincinnati.
''We pulled it out, won the series,'' Bailey said. ''We've been playing so good against these guys and also New York, and it just goes on further to show that we believe that we can play with any team in this league.''
It was a much better outing than in his first start against Houston this season when the Astros jumped on him for eight hits and nine runs - both season highs - in just two innings of an 11-1 loss on July 22.
The Astros missed opportunities in both the eighth and ninth innings to tie it or take the lead on a night they went 0 for 10 with runners in scoring position.
Jose Altuve's solo home run off Yusmeiro Petit got Houston within a run with one out in the eighth inning. The Astros loaded the bases with two outs but Blake Treinen struck out rookie Kyle Tucker to leave everyone stranded.
Houston had runners on first and third with two outs in the ninth, but Liam Hendriks struck out Michael Brantley for his 21st save.
The Athletics tagged Verlander right away in his second start since tossing his third career no-hitter on Aug. 1. Marcus Semien singled on his first pitch and he struck out the next two batters before Mark Canha walked. Seth Brown gave Oakland an early lead with an RBI double to left field.
It was Semien who got things going again in the third with a leadoff single. An out later, Olson extended his career high by hitting 32nd home run this season and third of the series to make it 3-0.
''They had a good game plan and really had some good at-bats,'' Verlander said. ''With that being said, I really only regret one pitch, to Olson. I yanked a fastball down and in and he put a good swing on it.''
Manager AJ Hinch isn't surprised to see the A's playing so well.
''They're here to stay,'' he said. ''They're a really good team. They put pressure on you from the beginning. From the first pitch from (Verlander), they just keep coming at you. They've got a ton of relievers, some good young kids so they're no secret around here.''
Verlander, who leads the AL with a 2.58 ERA, allowed five hits and three runs with 11 strikeouts in six innings to snap a three-game winning streak. He is just 25 strikeouts shy of reaching 300 for the first time in a season and needs 19 Ks to become the 18th player in MLB history to collect 3,000 in his career.
Robinson Chirinos singled and Josh Reddick doubled to start the bottom of the third. The Astros cut the lead to 3-1 when Chirinos scored on a groundout by George Springer.
The Astros had runners at first and second with no outs in the sixth after Bailey walked Altuve and Brantley. Bailey struck out Alex Bregman before he was replaced by Jake Diekman, who picked off Altuve as he tried to steal third base before striking out Alvarez to end the threat.
Astros: SS Carlos Correa (sore lower back) will begin a rehabilitation assignment with Triple-A Round Rock on Friday.
THEY SAID IT
Verlander on the possibility of reaching 3,000 strikeouts this season: ''I'd be lying if I said I didn't know where I was at. It's kind of on the back burner, I guess. I'm aware of it. I try not to focus on it too much, but it'd be pretty cool to get to it this year, for sure.''
Athletics: RHP Chris Bassitt (10-5, 3.64 ERA) will start for Oakland in the opener of a three-game series at Texas on Friday night. Bassitt is 5-1 with a 2.78 ERA in 10 starts since the All-Star break.
Astros: RHP Gerrit Cole (16-5, 2.73) is scheduled to start for Houston in the first of three games with Kansas City on Friday. Cole, who leads the league with a career-high 281 strikeouts, allowed one hit and fanned 15 in a season-high eight innings of a 21-1 win over Seattle in his last start.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Copyright 2019 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.