Aaron Judge hit two of New York's five home runs and the Yankees extended their AL wild-card lead by beating the Toronto Blue Jays 6-2 Thursday night.

Gleyber Torres and Anthony Rizzo also connected off Blue Jays starter Robbie Ray, and Brett Gardner added a solo homer as New York (91-68) slimmed its magic number to clinch a postseason spot to two. The Yankees are two games ahead of Boston and idle Seattle, both 89-70, after the Red Sox lost to last-place Baltimore 6-2 earlier Thursday. Toronto trails New York by three games.

New York has won eight of nine but could be in better shape entering a season-ending series against AL East-champion Tampa Bay. First baseman Luke Voit went on the injured list Thursday with a sore left knee, and infielder DJ LeMahieu was replaced in the bottom of the sixth inning because of right hip soreness.

Michael King (2-4) pitched 1 1/3 scoreless innings for the win in relief of Corey Kluber. Luis Severino worked a perfect seventh, Chad Green struck out three straight after giving up a leadoff double in the eighth and Aroldis Chapman finished in the ninth.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

New York’s first five hits were home runs. Judge hit a 455-foot solo blast in the first that landed in a disused lounge area below the center field scoreboard. He hit another drive to center, a 441-footer into the batter’s eye, as the Yankees homered three times in the sixth to erase a 2-1 deficit.

For Judge, the home runs were his 37th and 38th. It was his sixth multihomer game of the season and the 16th of his career.

Ray (13-7) walked Giancarlo Stanton after Judge’s first-inning blast but escaped further damage when Torres flied out to the warning track in right.

Gary Sánchez walked to begin the second, but Ray responded by retiring 13 consecutive Yankees.

Rizzo ended that streak with a one-out drive to right in the sixth, his 21st. Judge followed with his second homer, Stanton walked and Torres ended Ray’s outing with a two-run shot to left, his ninth.

Ray stumbled in the final chance to make his case for an AL Cy Young Award, allowing four hits, all home runs, and matching a season high by giving up five runs in 5 1/3 innings. He walked three and struck out four.

The four home runs allowed matched Ray’s career-worst, set April 29, 2016 against Colorado while pitching for Arizona.

Gardner made it 6-2 with a homer off Julian Merryweather in the ninth, his 10th.

Toronto’s Corey Dickerson answered Judge’s first homer with an RBI double off Kluber in the second, and Vladimir Guerrero Jr. chased Kluber with an RBI double in the fifth that bounced off the top of the center field wall.

Kluber allowed two runs and seven hits in 4 2/3 innings. King came on and walked Bo Bichette before getting Teocar Hernández to ground out.

TRAINER’S ROOM

Yankees: Recalled right-hander Albert Abreu from Triple-A Scranton/Wilkes-Barre. ... Manager Aaron Boone said tests Wednesday night showed no fracture for OF Joey Gallo, who left Wednesday’s game after being hit on the left forearm by a pitch in the seventh. Gallo was held out of the starting lineup but replaced Stanton in LF in the eighth.

Blue Jays: OF Lourdes Gurriel Jr. was held out of the lineup after playing the past two games because of soreness in his right hand. Gurriel needed two stitches to close a cut on the back of his hand after being spiked by teammate Randal Grichuk on a play in the outfield last Thursday.

UP NEXT

Blue Jays LHP Steven Matz (13-7, 3.88) starts Friday as the Blue Jays open a three-game home series against Baltimore. The Orioles have not named a starter. Matz is 1-1 with a 6.00 ERA in three starts against Baltimore this season.

Yankees: LHP Nestor Cortes (2-2, 2.85) starts Friday in the opener of a three-game home series against Tampa Bay. RHP Shane McClanahan (10-6, 3.44) is expected to start for the Rays.