Tony Parker scored six of his 32 points in the second overtime, Tim Duncan had 26 and the San Antonio Spurs beat Toronto 111-106, their fourth straight victory over the Raptors.
Manu Ginobili scored 15 points, Danny Green had 13 and Boris Diaw 11 as the Spurs won their third straight and improved their NBA-best road record to 7-1.
Parker made jump shots on consecutive possessions with less than 1:15 to go in the second overtime as the Spurs held on.
DeMar DeRozan led Toronto with 29 points, while rookie Jonas Valanciunas had 22. Kyle Lowry scored 20 points and Ed Davis had 15 points and 14 rebounds for the Raptors, who have lost their past three games by a combined seven points.
Toronto's Andrea Bargnani had a disappointing game, scoring four points and making just two of 19 field goal attempts.
Valanciunas calmly drained free throws to knot the score at 88-88 with 24 seconds left in regulation.
San Antonio gave the ball to Parker, who let the clock run down to six seconds, but almost turned it over as he drove.
Parker's 3-point effort fell short, giving Toronto one-tenth of a second to try for the winning basket, but Bargnani's no-look shot went wide, sending the game to overtime.
San Antonio led 92-90 on Duncan's slam dunk with less than 30 seconds to go in the first overtime when a foul by Parker gave possession to the Raptors.
But Parker stole Jose Calderon's inbounds pass and raced in for a layup, giving the Spurs an 94-90 lead with 24 seconds left.
Lowry answered with a 3 for the Raptors, cutting the gap to one, but Ginobili made a pair of free throws with 15 seconds left, making it 96-93.
DeRozan's dunk cut it to one with 14 seconds left and, after Gary Neal made one of two from the line, the Raptors called timeout, trailing 97-95.
DeRozan grabbed his own rebound and made a layup with 0.9 left, tying it at 97-97.
The Spurs couldn't get a shot off before the buzzer, forcing a second overtime.
Toronto never led in the second extra session, with Green's 3 at 4:43 giving the Spurs the lead for good.
Toronto opened the third with a 7-0 run, thanks in part to seven straight missed shots by San Antonio.
Toronto led 60-51 with 7:29 left but the Spurs erased the deficit thanks to eight points from Ginobili.
DeRozan made a driving shot with 27 seconds left and scored 12 points in the third as the Raptors took a 70-69 edge into the fourth.
What did you make of the Tall Blacks' World Cup campaign?