TORONTO -- Greg Bird hit a three-run homer and Sonny Gray pitched six effective innings as the New York Yankees clinched an American League wild card spot with a 5-1 win over the Toronto Blue Jays on Saturday.
Todd Frazier also homered for the Yankees (86-68), who are 16-6 in their last 22 games.
Teoscar Hernandez homered for the Blue Jays (72-83).
Gray (10-11) won for the fourth time against six losses since joining the Yankees in a trade with the Oakland Athletics July 31 by holding the Blue Jays to one run on four hits.
Toronto starter Joe Biagini (3-12) continued to look for his first win since June 21 after allowing three hits, including a home run, four walks and three runs in five innings. He is 0-6 in his past eight starts.
Hernandez hit his fourth homer since being called up for September, and his second in two days, in the third inning.
Danny Barnes replaced Biagini and pitched a perfect sixth and Aaron Loup pitched around a single in the seventh.
Frazier hit his 27th homer of the season in the eighth against Tim Mayza.
Yankees relievers Chad Green and David Robertson pitched a perfect seventh and eighth respectively and each had two strikeouts.
The Yankees scored a run in the ninth off Luis Santos on a double by Gary Sanchez, a walk to Chase Headley, a fielder's choice grounder to first by Jacoby Ellsbury and an infield single to third by Castro.
Aroldis Chapman pitched a perfect ninth for the Yankees.
NOTES: Yankees OF Brett Gardner was 0-for-4 Saturday to end an 11-game hit streak. ... Toronto INF/OF Steve Pearce (stiff lower back) will not play for the rest of the season he tries to recover from his back issue. He had not played since Sept. 8 when he left the game after one inning. ... Yankees RF Aaron Judge struck out for the 200th time this year in the first inning, the first player this season to reach that plateau. It is a major league record for a rookie. ... Yankees LHP Jaime Garcia (5-9, 4.19 ERA) will oppose Blue Jays RHP Marcus Stroman (12-8, 3.01) in the series finale on Sunday.