Sabathia (6-8) allowed four hits and struck out five to pick up his first win since June 16 after going 0-4 and allowing 31 runs — 29 earned — combined in his past six starts.
Things didn't look good early on Tuesday night when he allowed a solo home run to Marwin Gonzalez in the first inning. But he settled in after that, allowing only one single over the next five innings.
The Yankees built a five-run lead thanks in part to a two-run triple by Aaron Hicks by the time Evan Gattis homered to start Houston's seventh and cut it to 6-2. Sabathia was lifted after a two-out single by Carlos Gomez in that inning.
Houston starter Doug Fister (10-7) allowed nine hits and six runs, which both tied season highs, in 4 2/3 innings for the loss.
Gonzalez added a solo homer in the eighth for his first career multi-home run game. His first home run was right-handed and the second one from the left to make the switch-hitter the first Houston player to homer from both sides in the same game since Lance Berkman did it in 2006.
Tuesday's game was the first time Sabathia had allowed fewer than four runs since that win on June 16. Since then he'd allowed a season-high six runs in two games and a season-worst nine hits in another start.
Starlin Castro's run-scoring single with two outs in the third pushed the lead to 3-1.
Fister plunked Brian McCann to start the fifth inning before Teixeira singled. The Astros intentionally walked Castro with one out to load the bases before McCann scored on a sacrifice fly by Headley. The first triple of the season for Hicks came next to score two more and chase Fister.