Houston survived the highest-scoring performance in the NBA this season, a 45-point show from Carmelo Anthony.
Anthony scored the last of his points from the foul line with five seconds to go, bringing the Knicks within one, but after Harden was fouled he converted both his tries to account for the final score.
J.R. Smith missed a chance to tie the game at the buzzer.
Anthony converted 17-of-30 from the field and had 10 rebounds as well.
Houston made 38 free throws to 22 for the Knicks, who failed in their bid to win back-to-back games for the first time this season.