The Yankees' Aaron Judge and Gleyber Torres celebrate their 5-4...

The Yankees' Aaron Judge and Gleyber Torres celebrate their 5-4 win against the Red Sox in an MLB game at Yankee Stadium on Friday. Credit: Kathleen Malone-Van Dyke

An Aaron homered Friday night at the Stadium, as did a player wearing No. 99. But neither was named Aaron Judge.

The Yankees outfielder remained at 60 homers, going 1-for-4 with a seventh-inning single that elicited a polite round of applause from the sellout crowd of 47,346 at the Stadium.

Yankees fans could derive some joy from the game, a second straight 5-4 victory over the Red Sox, achieved in part because of Aaron Hicks, who went 2-for-3 with a solo home run and an RBI single.

Jose Trevino’s two-out RBI single on a 1-and-2 pitch in the eighth broke a 4-4 tie. That drove in Harrison Bader, who drew a pinch-hit walk with two outs, took off for second and went all the way to third on Matt Strahm’s wild pickoff throw.

Jonathan Loaisiga, who pitched a perfect eighth, allowed one-out singles by J.D. Martinez and Triston Casas in the ninth. He then struck out pinch hitter Abraham Almonte and got Reese McGuire on a grounder.

The Yankees (92-58), who have won 13 of their last 17 games, overcame another shaky outing by Gerrit Cole, who allowed a solo homer by Tommy Pham in the first inning and a three-run shot by Alex Verdugo (the “other’’ No. 99) into the Yankees’ bullpen in the sixth that tied it at 4-4.

After fanning Martinez for his third strikeout of the inning, Cole — still steamed over a 1-and-2 pitch to Verdugo he thought was a strike but appeared low — was thrown out by plate umpire Brian Knight, the pitcher’s first career ejection. Aaron Boone charged out of the dugout and soon was tossed for an MLB-leading ninth time.

“I’m just a competitor, I’m just upset,’’ Cole said. “It was the worst pitch of the sequence [the homer]. He put, obviously, a beautiful swing on it and did what he wanted to do with the pitch . . . The damage there is hard to swallow, but at the same time, there’s some things that we did well.”

Was it just that call alone or the whole game?

“It’s probably a little of both,’’ Cole said. “Probably a little bit just how the game was going. In the dugout, we were frustrated a bit from the offensive perspective, based on the chatter that I was listening to, and I thought there were several pitches that were on the edge that, sometimes they’re 50/50. I’ve done a pretty good job in my career not losing my cool like that. I went quite a while without an ejection. So just like emotions get the better of you.’’

Trevino said of the disputed pitch: “Thought it was a good pitch. Thought it got called on Judgie a couple of times.”

Did the call affect Cole’s next pitch? “Possibly,’’ he said. “That’s huge. As a catcher, you want that pitch; as a pitcher, you want that pitch. As a hitter, you get another pitch to live. That kind of situation, we’d like a strike there.”

Boone said of his own ejection: “I felt like there was something going on with Trevi [and Knight] there. I was obviously a little late in getting out there tonight so I didn’t want that to happen [Trevino getting ejected], so I was out there trying to protect those guys a little bit.”

Cole allowed four runs, five hits and two walks in six innings in which he struck out eight. The two homers gave Cole 31 allowed this season, second-most in the majors this season (the Nationals’ Josiah Gray has allowed 37). Cole did up his season strikeout total to 244 in 188 1⁄3 innings, second-most in franchise history behind Ron Guidry’s 248 in 1978.

  

“Coming off an outing where he made a couple of mistakes where he gave up some long balls in Milwaukee, I thought he was as dialed in as you could be,’’ Boone said. “I thought his body language was great all night. I thought his execution, both sides of the plate [was good], wasn’t overthrowing it. Thought he used his curveball really effectively tonight. He’s a pitch away from just having an awesome outing. I think there’s some frustration there, but I think there’s a lot of really good takeaways from this we need to keep building on.”

Hicks tied it at 1-1 in the third with the 100th homer of his career, ripping a 1-and-1 curveball to left-center.

Isiah Kiner-Falefa singled and Marwin Gonzalez walked to start the fifth. Hicks lined an RBI single to left to make it 2-1 and bring up Judge with two on and none out, but he struck out for the second time. Giancarlo Stanton flied to right, deep enough to allow Gonzalez to tag and make third, and Gleyber Torres sent a rocket past the diving Rafael Devers into the leftfield corner for a two-run double that made it 4-1.

In the race for the American League batting title, which would clinch the Triple Crown for Judge, his 1-for-4 night left him at .315. Boston’s Xander Bogaerts did not play and is at .314. Minnesota’s Luis Arraez went 1-for-5 and is at .312.

“The reality is he’s just missed two the last two nights — 113 miles an hour right at the track in center and then tonight 110,’’ Boone said. “He’s getting off the right swings, he’s making good swing decisions. It’s going to come.

"But it is a peek behind just how a great a player he is, too, that when he doesn’t hit the ball out of the ballpark, he’s still impacting us in a big way. I’ve just been really [impressed] with obviously all the noise around this and the excitement around this, understandably, he’s still going out there and putting together good at-bat after good at-bat.”

More Yankees headlines