New York stayed deadlocked with Baltimore in first place in the American League East with both teams winning their 80th game of the season.
Granderson hit a solo homer in the fourth and Cano contributed a two-run blast later in the inning. Granderson then hit a two-run shot in the seventh to give the Yankees a 5-1 lead.
Boston cut its deficit with a two-run seventh and Jarrod Saltalamacchia brought the Red Sox within one with a ninth-inning homer. Boston then put the tying run on base with two away when Mike Aviles reached on a fielding error by pitcher Rafael Soriano, but Jacoby Ellsbury grounded out to end the contest.
David Phelps (4-4) gave up a run on five hits in 5 2/3 innings to grab the win, his first in a month. Soriano recorded his 37th save.
Aaron Cook (3-10) lost his fifth straight decision, allowing three runs on seven hits in five-plus innings.
Boston Manager Bobby Valentine had a busy evening -- first sending outfielder Cody Ross scurrying to the hospital so he could be present for the arrival of his second child. Valentine was later kicked out of the game for arguing balls and strikes.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Ray Liotta sues skin care company over use of likeness