The Astros have lost seven in a row and 17 of their last 20.
Houston took an early 2-0 lead, but the Orioles rallied to make a winner out of starter Brian Burres.
Burres (6-5) equaled the largest one-season win total of his five-year career. He allowed three runs on seven hits in 5 2/3 innings.
Houston's Shawn Cacon (2-3) was roughed up for six runs on eight hits in five frames.
After the fourth-inning homers put the Orioles in front, they scored three times in the fifth on a two-run double by Kevin Millar and an RBI single by Jay Payton.
Baltimore took a 7-3 lead into the ninth, but the Astros managed two runs before George Sherrill was called on to record the final two outs and pick up his 24th save.