Sacramento led by as many as 21 points in the second half only to see Toronto close within six in the final minute.
The win enabled the Kings to keep pace with the Los Angeles Lakers in their bid to avoid the worst record in the Western Conference. The Lakers, who defeated Cleveland earlier in the evening, began the night tied with Sacramento and Utah at 16-32.
Sacramento has won two in a row after losing seven straight.
Cousins scored 25 points and had 12 rebounds. Rudy Gay added 24 points and Isaiah Thomas had 23 for the Kings. Sacramento shot only 39 percent from the field, but went to the foul line 51 times and made 41 of them.
Toronto fell to 2-2 on a five-game road trip that will wind up in Los Angeles on Friday for a game against the Clippers.
Kyle Lowry led the Raptors with 21 points and DeMar DeRozan finished with 18.
Dennis Rodman pledges to end trips to North Korea
Susan Sarandon 'very excited' about daughter's pregnancy