Toronto's losing streak is its longest since a 10-game slide from March 26 to April 12, 2006.
Randolph extended his team-record streak of double-doubles to 11 games.
The Raptors finished 0 for 13 from 3-point range and failed to make a 3 for the first time in 986 games, a streak that began Feb. 26, 1999, against Minnesota. The Raptors are the first team in NBA history to make a 3 in 900 consecutive games.
Toronto trailed 88-76 with 8:28 to play but roared back with an 11-0 run over the next 3½ minutes. DeRozan hit a jumper, Bargnani made two free throws and followed up with a jump shot, Johnson had a layup and Bargnani finished the run with a three-point play, making it 88-87 with 5:13 left.
DeRozan gave Toronto its first lead of the fourth quarter by making a pair of free throws with 3:58 left, putting Toronto up 92-91.
Conley put Memphis back on top with 2:10 left. After making one free throw but missing the second, Conley wound up with the loose ball and drove in for a layup to make it 96-94.
After a pair of free throws by DeRozan and a running jumper from Conley, Bayless tied it at 98-98 on a driving layup with 18 seconds left.
Memphis gave the ball to Gay, who let the shot clock wind down before driving and putting a shot up over the arms of Wright.
Toronto inbounded the ball to Sundiata Gaines, but Gay blocked his shot attempt as the buzzer sounded.
Sonny Weems dressed for Toronto despite not playing in the past 18 games because of back spasms. Weems last played Dec. 15 against Chicago.
The Raptors led 20-11 with four minutes left in the first, but Mayo scored seven points off the bench as Memphis rallied to take a 25-24 lead after one.
Tony Allen scored eight points in the second quarter and Gasol had seven, but Bargnani answered with eight to keep the Raptors close. Memphis led 51-49 at the half.
Gay scored eight points in the third, including a 3-pointer with five seconds left, and Randolph had six as Memphis took an 80-74 lead into the fourth.
Notes: Toronto signed G Sundiata Gaines to a second 10-day contract. ... The Raptors acquired C Alexis Ajinca, a future second-round draft pick and cash from Dallas in exchange for the draft rights to F Giorgos Printezis. ... Former NFL running back Jerome Bettis attended the game.