NEW YORK -- Sonny Gray said he didn't notice what was posted on the out-of-town scoreboard at Yankee Stadium, but his manager did.
A big chance to put more pressure on Boston in the AL East race. There, and then gone.
The Yankees stayed three games behind the division-leading Red Sox, routed by Houston 12-2. Each team has three games left and both are assured playoff spots -- if they wind up even, the Yankees would host Boston in a tiebreaker Monday.
"It's frustrating, because we had a chance to pick up a game," Yankees manager Joe Girardi said.
"It just wasn't meant to be tonight," he said.
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.
Gardner and Judge hit back-to-back homers to begin the bottom of the first inning , and Bird connected in the fourth for a 4-1 edge.
But with the scoreboard already showing Boston trailing by a lot, New York allowed its most runs in an inning this year.
Gray (10-12) gave up a pair of one-out singles, and a wild pitch and Gary Sanchez's major league-leading 16th passed ball each permitted runs to score. Ramos added a two-out, two-run homer off Gray, and Peter Bourjos hit a two-run triple and Cesar Puello had an RBI single against Jonathan Holder.
A crowd that earlier chanted "MVP! MVP!" for Judge wound up booing as the Yankees eventually ended an inning that also included a throwing error by Sanchez, a hit batter and a walk.
Gray walked a season-worst five in 4 2/3 innings.
"I was kind of all over the place all night," Gray said.
Said Rays manager Kevin Cash: "That was a pretty impressive offensive inning by our part, pieced together a bunch of hits."
Judge has gotten an extra-base hit in eight straight games. He has 11 total hits during that span -- seven homers and four doubles. Overall, the rookie has a career-best 11-game hitting streak.
Judge has 32 homers at home this season, tying Babe Ruth's team record.
Bird has posted an RBI and extra-base hit for six games in a row.
Rays rookie Jake Faria made his first start since Aug. 16 after missing time because of an abdominal strain. He was pulled after the third while pitching in place of Alex Cobb, who's done for the season because of an innings limit.
The Yankees top the majors with 239 home runs, with 31 in the last 14 games. ... Gardner and Judge became the first Yankees to begin a first inning with homers since Derek Jeter and Curtis Granderson in 2012 vs. Minnesota.
Ramos has an RBI in five straight game, totaling 10 in that span. In the series opener Tuesday night, his bid for a grand slam was taken away when Hicks reached above the center field fence for a catch.
Yankees center fielder Jacoby Ellsbury climbed the wall on Ramos' drive, but couldn't reach it.
"I got a little bit scared when he stopped and jumped, but finally I got that one," Ramos said.
Yankees: RHP Adam Warren (lower back spasm) is set to return Friday. Girardi said he'd like to get the reliever into a game or two before the playoffs. ... Relievers Chad Green and Dellin Betances were held out of this game.
Rays: RHP Jake Odorizzi (10-8, 4.26 ERA) starts as the Rays host Baltimore in their final series of the season.
Yankees: RHP Masahiro Tanaka (12-12, 4.94) pitches vs. Toronto and RHP Joe Biagini (3-12, 5.34) on Friday afternoon at Yankee Stadium. If the Yankees reach the AL Division Series, Tanaka would line up to pitch Game 1.
More AP baseball: https://apnews.com/tag/MLBbaseball
C.J. Cron homered and scored three runs, and the Tampa Bay Rays beat Kansas City 5-3 on Wednesday to complete a three-game sweep of the woeful Royals.
Red Sox manager Alex Cora said he doesn't agree with Carson Smith's opinion that fatigue could have contributed to his dislocated pitching shoulder.
C.J. Cron goes deep in the third inning to extend Tampa Bay's lead over Kansas City to 4-0.
Joey Gallo wouldn't tell the Rangers "no" if they asked him to fill the team's hole at third base, but admitted, "I don't want it. ... I hate it, no joke."
Dexter Fowler reached base four times and drove in two runs in his return to the lineup and the St. Louis Cardinals beat former starter Lance Lynn and the Minnesota Twins 7-5 on Wednesday.
J.A. Happ reached three times and allowed only two baserunners over seven innings, and the Toronto Blue Jays got their first road victory against the New York Mets, 12-1 on a rainy Wednesday in Queens.