HOUSTON -- The Houston Rockets were on the verge of their third straight home loss after blowing a double-digit, second-half lead for the second consecutive game.
This time, guard James Harden said, the Rockets found the will to win.
Jeremy Lin scored 31 points off the bench, Dwight Howard had 18 points and 24 rebounds, and the Rockets beat the Toronto Raptors 110-104 in double-overtime to snap a two-game losing streak.
"(This game) was something," Houston coach Kevin McHale said. "We still are a little bit in the mud, but the guys came out defensively and did a really good job. We were grinding. We just found a way to win. That's just kind of what we had to do."
Lin shot 10 of 17 from the field and hit 8 of 9 from the free throw line. Harden finished with 26 points and 10 assists.
Howard was just 4 of 12 at the foul line. Chandler Parsons had 18 points, five rebounds and five assists for the Rockets.
Lin was the first player to score 30-plus points off the bench for Houston since Chase Budinger had 30 points against Cleveland on Feb. 23, 2011.
"Midway through the third I was feeling pretty good," Lin said. "I got in my rhythm. I got a few shots to go down. Everything just kind of slowed down."
Rudy Gay led the Raptors with 29 points and 10 rebounds but shot 11 of 37 from the field. DeMar DeRozan added 22 points, but he struggled as well, finishing 6 of 25.
Jonas Valanciunas chipped in 10 points and 13 rebounds, Amir Johnson had 10 points and 10 boards, and Kyle Lowry netted 16 for Toronto, who shot 33 per cent from the field.
"I love the way we fought," Raptors coach Dwane Casey said. "Anybody that didn't appreciate that, we had 30 more attempts. How many times have you seen that? We just have to make shots. We only shot 25 per cent in the first half, and we got back in the game with our defence."
After Harden missed a jumper, Howard grabbed a rebound and gave it to Terrence Jones for a layup to give the Rockets a 106-104 lead with 1:13 to go in the second overtime. Gay missed a jumper, and Johnson missed the tip on the other end before Lin hit a floater with 33 seconds left to give the Rockets a four-point lead.
Gay missed another jumper, and after review, Houston was awarded the ball with 26 seconds left. Patrick Beverley made one of two free throws with 20 seconds left, and Gay missed a 3-pointer with 15 seconds remaining. Harden made one of two free throws to push the lead to six and ice the win.
"We lost two at home," Harden said. "We can't lose three in a row at home. We are too much of a good team to lose three games. We did whatever it took to pull it out tonight."
Harden scored seven of the Rockets' first nine points in the second overtime, but Gay tied it at 104 with a 3-point play with 1:50 to go.
Gay tied the score at 95 in the first overtime, hitting a tough 3-pointer from the top of the top of the arc with 0.9 seconds remaining, and Lin missed a 3-pointer at the buzzer to send the game to a second extra period.
"We fought with them obviously through two overtimes, and shots that we usually hit weren't falling," Gay said. "You could say fatigue or a lot of different things, but they are a great team, and they played well. I just wish I would've hit the easy ones and maybe things would've worked out differently."
Trailing 80-66 after Lin's layup with 8:32 remaining in the fourth, Toronto knotted the score at 84 six minutes later on Terrence Ross's follow shot, capping an 18-4 run.
Harden made one of two free throws to tie it at 87 with 34 seconds remaining before Gay missed a jumper with 12 seconds left, but the referees called a 24-second violation, saying the ball never hit the rim.
After review, the ball hit the rim, and the officials jumped it up at midcourt, with the Rockets winning it, but Harden's jumper at the buzzer was short, sending the game to overtime.
"It was a long, intense game," Harden said. "I think in the first half we did a great job defending. They only had 33 points at the half, but in the second half, we let up. Gave them confidence early in the second half when they started making shots. We have to battle it out and fight it out."
NOTES: Toronto forward Steve Novak missed Monday's game with back spasms. . Houston guard/forward Francisco Garcia did not play in Monday's game as well with flu-like symptoms. . Harden was fined $5,000 Monday for violating the NBA's anti-flopping rules for a second time. Harden was cited for a fourth-quarter flop against the Los Angeles Clippers Saturday.