The Raptors raced to a nine-point advantage early in the fourth period only to go scoreless for more than 4 minutes while Memphis was staging its comeback.
Gay put the Grizzlies in front for good with 26 seconds left and scored 23 points. Gasol and Mike Conley had 21 points each.
Memphis won its third straight and kept the Raptors from posting back-to-back victories for the first time in five weeks.
Justin Bieber crashes Drake Bell's album release party
Chipotle plans first price increase in 3 years