Heap caught a 1-yard touchdown pass from Joe Flacco and a 14-yarder from Troy Smith.
McGahee scored on runs of 1 and 4 yards and ended up with 112 yards on 12 carries.
Baltimore (6-3) outscored the Texans 29-7 in the second half.
Flacco completed 15-of-23 passes for 185 yards and two touchdowns, leading the Ravens to their fourth straight win.
.Rosenfels completed 23-of-38 passes for 294 yards, including a 60-yard scoring toss to Kevin Walter.
Houston is 3-6.