Andrea Bargnani had 32 points and nine rebounds and Toronto beat New Jersey for the sixth straight time, 98-92 Friday night.
Linas Kleiza had 18 points and matched his career-high with 12 rebounds, Jose Calderon returned from a four-game absence to put up 15 points and 14 assists for Toronto.
The Raptors had lost two straight and six of their previous seven.
Brook Lopez scored 20 points and Devin Harris had 15 for New Jersey, while former Raptor Kris Humphries had 12 points and 12 rebounds.
Travis Outlaw scored 14 points for the Nets, who have lost nine of 10 and are 2-12 on the road.
Toronto has not lost to New Jersey since a 94-87 home defeat on Dec. 15, 2008. DeMar DeRozan had 14 points and Leandro Barbosa scored 10.
New Jersey led 71-69 to begin the fourth but consecutive baskets by Bargnani gave Toronto a 73-71 lead. Farmar and Outlaw hit back-to-back 3-pointers and Farmar followed up a steal with a fast break dunk, putting the Nets up 79-73 and prompting Toronto to call timeout.
The stoppage seemed to reinvigorate the Raptors, who responded with a 16-2 run.
Bargnani, Calderon, and Kleiza all hit 3-pointers during the run that made it 89-81 with 4:47 left.
Outlaw made a pair of free throws and Lopez hit five of six from the line to bring the Nets back to within two. Bargnani made a turnaround jumper but Humphries replied with a dunk, making it 92-90 with 1:39 to play.
DeRozan had a driving dunk and Lopez tipped in Harris' missed layup before Barbosa hit a 3-pointer with 15 seconds remaining, giving Toronto a 97-92 lead.
Bargnani returned to Toronto's starting lineup after missing Wednesday's loss to Chicago with a sore left knee, while Calderon started after missing four games with a sore left foot.
New Jersey lost Quinton Ross just two minutes into the game when the swingman limped off with a bruised lower back and immediately headed to the locker room. He did not return.
Notes: Kleiza started in place of Sonny Weems, who was scratched with back spasms. ... Toronto's Amir Johnson fouled out with six points in 22 minutes. ... The game marked the Toronto return of Nets assistant coach Sam Mitchell, who coached the Raptors from 2004 to 2008. Mitchell went 156-189 with Toronto, winning the Atlantic Division and being named coach of the year in 2006-07.