HOUSTON — Westbrook had 12 rebounds and nine assists after notching his 139th triple-double in his last game to pass Magic Johnson for second-most all-time.
A 3-pointer by Shai Gilgeous-Alexander with 19 seconds left got Oklahoma City within 3. Westbrook made 1 of 2 free throws before fouling Nerlens Noel, who made both free throws.
But Harden, who was 21 of 22 from the line, made two free throws with 13.2 seconds to go to make it 114-110.
Gilgeous-Alexander cut it to 2 with a basket, but Harden made two more free throws to secure the victory.
It was the first game between these teams since a blockbuster summer trade reunited Westbrook with Harden and sent Chris Paul to Oklahoma City after the nine-time All-Star failed to help the Rockets to a title in two seasons in Houston.
Paul had 15 points, four assists and five rebounds.
Just before tipoff, Westbrook approached the Thunder bench and hugged coach Billy Donovan before slapping hands and greeting virtually every player on the bench. Westbrook spent the first 11 years of his career in Oklahoma City where he was the face of the franchise before moving to Houston in the deal the Rockets hope will help bring them their first title since 1995.
Gilgeous-Alexander had 22 points and Dennis Schroder added 22 points to lead the Thunder, who fell to 1-3.
Danilo Gallinari made a 3-pointer to get the Thunder within 4 with about 3 1/2 minutes left, but Westbrook added a jump shot seconds later to push Houston's lead to 106-100.
Paul hit a 3 for the Thunder after that before a turnover by Westbrook.
Harden made two free throws with about 90 seconds left to leave Houston up 108-103.
Paul added a basket, but Westbrook drove into the lane before kicking it out to P.J. Tucker for a 3 to push the lead to 6 with a minute left.
Houston used a 39-point third quarter to take an 11-point lead into the fourth quarter. Both teams had trouble getting going on offense to start the quarter and the only points either team scored in the first three minutes of the fourth came on two free throws Gallinari at the start of the quarter.
Paul made the first field goal of the fourth quarter on a 3-pointer with just over eight minutes remaining before a layup by Schroder cut the lead to 91-87.
Houston scored its first points of the quarter when Harden made two free throws about a minute later.
The Rockets led by 4 soon after that when Harden was fouled on a 3-pointer and made all three free throws to make it 96-89. That was the start of a 7-4 run that left Houston up 100-93 with five minutes to go.
The Rockets opened the third quarter with a 17-4 run to erase a 10-point halftime deficit and take a 69-66 lead with about seven minutes left in the quarter. A 3-pointer by Tucker put Houston on top and Westbrook punctuated the run with a dunk before screaming and flexing as he passed the Thunder bench.
Thunder: Steven Adams went to the locker room in the fourth quarter and didn't return. It was unclear why he left the game. ... Oklahoma City made 13 of 35 3-pointers. ... The Thunder attempted just two more free throws than Harden did alone.
Rockets: G/F Gerald Green, who has been out since Oct. 10, had surgery on Monday to repair a broken bone in his left foot and is expected to be out about six months. ... Tucker finished with 17 points.
Thunder: Host Portland on Wednesday night.
Rockets: Visit Washington on Wednesday night to start a four-game road trip.