With star guard Russell Westbrook lost for the playoffs following knee surgery, Oklahoma City saw its lead in the Western Conference quarterfinal series cut to 3-2.
Houston will attempt to pull even when it hosts Game 6 on Friday. A Rockets win in that one would force a seventh and deciding game in Oklahoma City on Sunday.
Harden, who was a member of the Oklahoma City team that won the Western Conference title last season, scored 31 points and grabbed nine rebounds. Omer Asik added 21 points and 10 boards.
Houston took a 12-point lead into the fourth quarter, but the Thunder came within six on a 3-pointer by Reggie Jackson with 4:17 to play.
Asik then made five free throws down the stretch to help the Rockets hang on and Francisco Garcia all but wrapped up the victory when his 3-pointer gave Houston a 13-point cushion with 1:39 to play.
Kevin Durant was unable to carry Oklahoma City by himself, although he scored 36 points to go with seven rebounds and seven assists. The Thunder shot just 41 percent from the field and went 8-of-33 from 3-point range.