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
The Milwaukee Brewers have added RHP Zach Davies to the National League Championship Series roster, replacing LHP Gio Gonzalez, who left Tuesday night's game with a high left ankle sprain.
After Manny Machado's latest controversial slide in Game 4, SportsCenter looks at Machado's questionable history of being aggressive on the bases.
Christian Yelich says Manny Machado has always been a dirty player and kicking Jesus Aguilar didn't look like an accident.
Clayton Kershaw's start in Game 5 in the NL Championship Series is one of the biggest of his career -- and could be his last with the Dodgers.
Dodgers ace Clayton Kershaw takes the hill for perhaps the biggest start of his life, and the Astros turn to Charlie Morton, who hasn't pitched in two weeks.
Five hours and 15 minutes after Game 4 of the NLCS started, the Dodgers outfielder finally delivered the deciding blow as L.A. knotted things up with Milwaukee.