Brad Peacock struck out Stephen Piscotty with the potential tying runs aboard to end the eighth inning, protecting a lead that turned into the Astros' sixth straight win.
After the A's scored in the first inning on a wild pitch by Houston starter Lance McCullers Jr., the Astros got even immediately when Carlos Correa led off the top of the second with his 11th homer of the season off A's starter Daniel Mengden.
Yuli Gurriel followed with a double, and after Josh Reddick walked, Gattis bombed his three-run homer to left field to give Houston a lead it never relinquished.
The A's got within 4-2 in the third in a sacrifice fly by Piscotty, but Gattis responded again, this time smacking his two-run double that scored Correa and Reddick for a 6-2 lead in the fifth.
The five RBIs were one more than Gattis had ever recorded in a game. He has nine four-RBI games in his career.
McCullers (8-3) went seven innings, allowing two runs and five hits. He walked three and struck out five, beating the A's for the third time this season.
He was replaced in the eighth by Collin McHugh, against whom the A's loaded the bases with two outs on two hit batsmen and an error.
Mark Canha got Oakland within 6-3 with an RBI single before Peacock came on to strike out Piscotty to escape further damage.
Astros closer Ken Giles pitched a quiet ninth inning for his 11th save.
Mengden (6-6) fell to 0-5 in his career against the Astros, getting pulled after giving up six runs and eight hits in 4 2/3 innings. He walked four and struck out one.
Gattis, Correa, Gurriel, Reddick and Tony Kemp had two hits apiece for the Astros, who improved to 5-0 on their current 10-game trip. Correa and Reddick scored twice apiece.
Matt Chapman went 3-for-3 with three doubles for the A's, who fell to 3-2 on their 10-game homestand.
Dustin Fowler added two hits for Oakland, which was out-hit 12-7.
--Field Level Media