HOUSTON -- DeMar DeRozan scored 21 of his 24 points in the third quarter and the Toronto Raptors beat the Houston Rockets on Wednesday night 115-102 on Wednesday night to snap a two-game skid.

Raptors avoided losing three in a row for the first time since last November, and ended a nine-game losing streak in Houston.

James Harden had 29 points and 15 assists for Houston, but also had 12 turnovers. The Rockets lost for the first time in four games.

The Rockets trailed by 15 entering the third quarter before using a 9-2 run to open the second half and get to 56-48. That run was powered by a pair of 3-pointers by Trevor Ariza and a third by Patrick Beverley.

DeRozan got hot soon after that, scoring all of Toronto's points in an 11-7 run that extended the Raptors' lead to 72-57 midway through the third quarter. DeRozan had a two-handed dunk during that stretch and capped it with a 3-pointer. He made 8 of 12 shots in that period, including both of his 3-point attempts and also had four assists and three rebounds in the frame. He finished with nine assists, five rebounds and two steals.

The Rockets cut into the lead with an 18-8 run, highlighted by 3-pointers from Ryan Anderson and Harden, to get within seven points with about 2 minutes remaining. But DeMarre Carroll hit a 3-pointer before a turnover by Harden led to a dunk by him to thwart the comeback attempt and extend the lead to 111-99 with 90 seconds left.

The Raptors led by two early in the second quarter before going on 16-6 run to make it 46-34 with about 2 1/2 minutes in the first half. Kyle Lowry started that spurt with a 3-pointer and had six points in that span.

TIP-INS

Raptors: DeRozan received a technical foul in the third quarter. ... Carroll finished with 20 points and three blocks. ... Lowry had 17 points and nine assists. ... Jonas Valanciunas had 15 points and 16 rebounds.

Rockets: Houston finished with 14 3-pointers, to give the team at least 10 in 14 straight games. ... Montrezl Harrell got a technical for taunting late in the second quarter. ... Wednesday was the first time Houston has lost since Beverley returned after missing the first 11 games after arthroscopic knee surgery. He had 10 points and 10 rebounds and four assists.

UP NEXT

Raptors: Travel to Milwaukee on Friday.

Rockets: Travel to Sacramento on Friday to start a five-game trip.