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
Cards' Yadier Molina takes exception to quips by Cubs' Kris Bryant
Cardinals catcher Yadier Molina took exception to quips about St. Louis by Cubs star Kris Bryant and Ryan Dempster, saying only "stupid players and losers" make fun of other cities.
Kris Bryant: 'Not good' that stars Bryce Harper, Manny Machado remain unsigned
Kris Bryant and Evan Longoria expressed frustration that several free agents, including stars Bryce Harper and Manny Machado, are still looking for jobs as February nears.
Buster's Buzz: Red Sox repeat? Four question marks facing the champs
From health to hangovers, Boston still must find a few answers in its quest for a second straight ring.
Yankees sign reliever who criticized Babe Ruth
Mike Golic finds it comical that the Yankees signed reliever Adam Ottavino who previously stated he would "strike out Babe Ruth every time."
Mariano Rivera, Lee Smith and what makes a Hall of Fame closer
One is a first-ballot lock. The other a last-chance inductee. Here's what Cooperstown's 2019 ninth-inning stars tell us about Hall standards for the position.
Angels reach one-year deal with Cody Allen to be closer next season
The Los Angeles Angels have reached an agreement with relief pitcher Cody Allen on a one-year deal to be their closer next season, league sources told ESPN.