PHOENIX - Andrea Bargnani's return provided the Toronto Raptors with the lift to end two losing streaks -- one that had lasted two weeks, the other eight years.

Bargnani, absent for six games with a left calf strain, scored 27 of his 36 points in the second half, and the Toronto Raptors snapped an eight-game losing streak by beating Phoenix 99-96 on Tuesday night, their first win over the Suns in eight years.

The Raptors had lost 14 in a row to Phoenix, last beating the Suns on Feb. 10, 2004. It was tied for the third-longest active streak of its kind in the NBA.

Bargnani scored 18 in the third, one shy of his career best for a quarter, making 4 of 5 three-pointers.

"I didn't do anything different from the first quarter because I was pretty aggressive in the first quarter too, I just didn't score," he said. "Jose (Calderon) told me to shoot from the outside because I was just driving the ball and everybody was waiting for me. They found me open and they went in. it was all good. "

Former Suns star Leandro Barbosa scored 19 and James Johnson 18 for the Raptors.

Marcin Gortat had 21 points and 12 rebounds and Steve Nash had 17 points and 14 assists for the Suns. Hakim Warrick also scored 17 points.

Phoenix was back from a five-game road trip that ended the previous night with a loss at Dallas.

"Obviously we were struggling for energy and I think that was the key, especially in that third quarter," Nash said. "They beat us on all the second-effort plays. They made a lot more of the plays, hustling for loose balls or running the floor, little things like that."

Nash said Bargnani is especially effective when the threes start to fall for him.

"It really stretches the floor and that makes him a terrific driver because you have to get out to him so quickly," Nash said. "He was just too much for us."

Toronto trailed by as many as 14 early and was down 52-48 at the break. A 10-0 run put the Raptors ahead 79-69 on Barbosa's 15-footer with 30 seconds left in the third. Warrick's layup made it an eight-point margin entering the final quarter.

Barbosa's running bank shot gave Toronto its biggest lead at 83-71 with 9 1/2 minutes to play. Bargnani's 14-foot runner a 93-87 advantage before the Suns managed a late threat.

Jared Dudley's three-pointer cut it to 94-90 then after an exchange of baskets, Dudley stole Rasual Butler's inbounds pass for a breakaway dunk to cut the lead to 96-94 with 23 seconds left. But Vargnani -- 12 of 12 at the line for the game -- sank two free throws with 22.9 seconds to go and the Suns misfired from long-range to seal the outcome.

"Andrea coming back makes everything easier for everbody else," Toronto coach Dwane Casey said. "He opens up the lane for L.B. for layups, James to get in the lane and get offensive boards. He is kind of the hub for everybody to play off of."

The Suns made 9 of their first 13 shots to take a 24-14 lead and were up 35-21 after Sebastian Telfair made two free throws with 9:26 left in the second quarter. Phoenix still led 52-42 on Michael Redd's 19-footer, but James Johnson scored the final 6 seconds of the half to cut the lead to 52-48 at the break.

Suns backup centre Robin Lopez was ejected after a run-in with referee Rodney Mott with 8:14 left in the first half. Lopez, upset with a foul call, glared at Mott as he walked to the Suns bench, brushed against the official as he walked past him, then turn around and glared again before the ref decided he'd seen enough.

NOTES: Entering the game, the only active win streaks longer than the Suns-Raptors were Portland's 16 straight over Minnesota and the Los Angeles Lakers' 15 in a row over Minnesota. ... Toronto had Monday off after losing to the Los Angeles Clippers on Sunday. The Raptors were on the second stop of a four-game trip. ... The Suns' Grant Hill went to the bench bleeding after getting hit in the face fouling Bargnani in the waning seconds. ... It was the first time Toronto beat Phoenix since Nash rejoined the Suns prior to the 2004-05 season.