Miami Marlins' Giancarlo Stanton hits a home run during the fourth inning of a baseball game against the Atlanta Braves, Thursday, Sept. 28, 2017, in Miami. (AP Photo/Wilfredo Lee)
Miami Marlins' Giancarlo Stanton hits a home run during the fourth inning of a baseball game against the Atlanta Braves, Thursday, Sept. 28, 2017, in Miami. (AP Photo/Wilfredo Lee)

New York — Aaron Judge hit his 51st home run to give the Yankees a quick lead, but New York missed a big chance to tighten the AL East race when Sonny Gray and the bullpen fell apart Thursday night in a 9-6 loss to the Tampa Bay Rays.

The Yankees stayed three games behind division-leading Boston, which fell to Houston, 12-2. Each team has three games left and both are assured playoff spots — if they wind up even, the Yankees would host the Red Sox in a tiebreaker on Monday.

Brett Gardner, Greg Bird and pinch-hitter Aaron Hicks also homered for New York, which had won three in a row. Wilson Ramos homered during a seven-run burst in the fifth inning for the Rays, who had lost three straight.

Marlins 7, Braves 1

Miami — Giancarlo Stanton homered twice to become the first player to hit 59 in a season since 2001, and Miami opened the last series of Jeffrey Loria’s tenure as owner by beating Atlanta.

Stanton hit a solo home run in the fourth, then added a two-run drive in the eighth that would have gone 467 feet unimpeded, according to MLB’s Statcast.

He has 33 home runs since the All-Star break and 10 multihomer games this season. He became the sixth player to reach 59, joining Barry Bonds, Sammy Sosa, Mark McGwire, Roger Maris and Babe Ruth.

Indians 5, Twins 2

Cleveland — Carlos Carrasco struck out 14, Jason Kipnis and Roberto Perez hit two-run homers and the Indians notched their 100th win over the understandably sluggish Twins. Minnesota clinched a wild-card berth hours earlier Thursday.

Carrasco (18-6) dominated a Minnesota lineup loaded with reserves and September call-ups. He allowed six hits — all singles — in 8⅓ innings and improved to 3-0 with a 0.92 ERA against the Twins. The right-hander also moved into a tie for the league lead in wins with teammate Corey Kluber and Kansas City’s Jason Vargas.

Brewers 4, Reds 3

Milwaukee — The Brewers closed within two games of Colorado for the National League’s second wild card with three games left, rallying to beat Cincinnati as Brett Phillips hit a go-ahead double in the sixth inning.

Milwaukee (84-75) closes the regular season at St. Louis, and the Rockies host the Los Angeles Dodgers. The Brewers are assured of their best record since finishing 96-66 in 2011, when they lost to the Cardinals in the NL Championship Series, Milwaukee’s last playoff appearance.

Cubs 2, Cardinals 1 (11)

St. Louis — The Cardinals were eliminated from postseason contention when Chicago’s Leonys Martin leaped at the center-field fence to rob Paul DeJong of a tying home run with two outs in the 11th inning.

St. Louis, which went 5-14 against its rival, missed the playoffs in consecutive seasons for the first time since 2007 and 2008. At 82-77, the Cardinals are assured their fewest wins since going 78-84 in 2007.

Nationals 5, Pirates 4

Washington — The NL East champion Nationals began their last — and meaningless — series of the regular season without a sore Bryce Harper and with a blown save by closer Sean Doolittle in what became a victory over the Pirates, whose starting pitcher, Ivan Nova, left after getting hit by a pitch on his throwing hand while batting.

Tigers 4, Royals 1

Kansas City, Mo. — Daniel Norris threw five scoreless innings to pick up his first victory in more than three months as Detroit snapped a season-high nine-game losing streak.

Athletics 4, Rangers 1

Arlington, Texas — Ryon Healy hit a tiebreaking two-run single in the sixth inning to help Oakland beat Texas.

Bob Melvin is set to manage at least two more years for the Athletics, with his latest extension announced Thursday set to take him through the 2019 season.

He had been signed through 2018 in a deal he reached in September 2015. In late July, the 55-year-old former catcher earned his 1,000th managerial win.

The A’s have repeatedly expressed their commitment to having the Bay Area native as their on-field leader.