Amir Johnson had 10 points and nine rebounds for the Raptors, who hadn't won three straight since a five-game winning streak from Feb. 8 to 19.
DeRozan scored 14 in the fourth quarter and finished 9-for-9 at the free throw line, converting a vital pair in the final 15 seconds. He finished one point shy of his career high, set last Nov. 12 against Utah.
Deron Williams scored 30 points, Brook Lopez had 16 and Andray Blatche 15 for the Nets, whose four-game winning streak was snapped. Brooklyn remains two games behind the third-place Pacers in the Eastern Conference, failing to capitalize on Indiana's 90-80 loss to New York.
Brooklyn trailed 70-59 to begin the fourth, but a jump shot by Joe Johnson cut the gap to 74-70 with 6:08 left.
DeRozan answered with a three-point play, giving Toronto a 77-70 lead.
Williams made a pair of free throws and Blatche hit one of two at the line, cutting it to 77-75, but Gay stole an errant pass by Williams and completed a three-point play, putting Toronto up 80-75 with 4:42 to go.
Raptors guard Kyle Lowry made one of two from the line after a clear path foul and Gay hit a pull-up jumper on the following possession, making it 83-75 with 3:37 left and forcing the Nets to call a timeout.
Lopez hit a free throw and Williams followed with a jumper, but DeRozan made a 3 from the wing with 2:42 remaining, giving the Raptors an 86-78 lead.
[to top of second column]
Williams forced a steal and made a 3, cutting it to 86-82 with 1:39 on the clock, but DeRozan answered with a pair of free throws.
Joe Johnson's 3 with 24 seconds left trimmed the deficit to 91-87 and Lowry missed two free throws. Johnson tried another 3 but missed the rim, and DeRozan sealed it with the pair of free throws.
DeRozan scored 11 in the first and Gay banked in a 3 at the buzzer as the Raptors led 24-20 after one.
Gay scored seven points in the second, two of them on an alley-oop dunk from Kyle Lowry with 3:16 left that put the Raptors up 46-26. Toronto led 51-32 at the half.
Williams scored 15 points in the third and Lopez had 12 but the Nets still trailed by 11 heading into the fourth.
NOTES: Toronto outrebounded Brooklyn 48-38. ... Former Raptor Reggie Evans had 16 rebounds for the Nets but didn't take a single shot. ... Keith Bogans started for Brooklyn in place of F Gerald Wallace, who missed his second straight game with a sore left heel. ... Raptors C Jonas Valanciunas (neck) missed his second straight game. ... Toronto G Terrence Ross and F Landry Fields dressed but did not play. Ross missed Friday's home win over Chicago with a sore left ankle, while Fields sat out due to illness. ... Arizona Cardinals receiver Larry Fitzgerald attended the game.
Press; By IAN HARRISON]
Copyright 2013 The Associated
Press. All rights reserved. This material may not be published,
broadcast, rewritten or redistributed.