BOSTON (AP) — For the second straight night, the Yankees tried to protect a one-run lead against the Red Sox.

For the second straight night, Boston found a way to rally past its longtime rival.

Rafael Devers hit two home runs, including a go-ahead blast in the fifth inning, to help the Red Sox best Yankees ace Gerrit Cole for the second time this season at Fenway Park in a 6-2 win Friday night.

Devers followed his two-run homer with a three-run shot in the seventh — the 100th of his career.

“That’s the kind of games we need in order to continue to win ballgames to be where we want to be,” Devers said through a translator. “Everybody contributed. Everybody has a role and they completed it.”

The Red Sox, who rallied from a 1-0 deficit for the second game in a row, earned their ninth victory over New York in 11 meetings this season. Boston, which has won its last four overall, has come from behind in 31 of its AL-leading 60 wins. The Red Sox also maintained their one-game AL East lead over Tampa Bay and increased their lead to nine games over the third-place Yankees.

Yacksel Rios (3-0) got the victory, pitching two scoreless innings to cap a strong night from the bullpen after starter Eduardo Rodriguez left in the second inning after experiencing migraine symptoms. Five Boston relievers combined to allow one run off four hits the rest of the way.

“It was a team effort from top to bottom," Red Sox manager Alex Cora said. "We didn’t win the game early on, but we were winning innings.”

Cole (10-5) started strong for New York, but was pulled after five innings, giving up three runs off six hits, striking out eight and walking two. He has surrendered five home runs at Fenway this season.

“They did make him work. That's the one thing they did,” Yankees manager Aaron Boone said. “They had some long at-bats against him. ... Even though they weren't able to break through on him, they were able to ding him.”

Rodriguez was walking back to the mound after giving up the game’s first run, an RBI double to Brett Gardner, when he put his hands on his hips and doubled over.

He was attended to by trainers before walking off the field on his own power alongside Cora, who put his arm around him. Rodriguez was replaced by Phillips Valdez. He hit the second batter he faced but struck out the side to limit the damage to a run.

Rodriguez’s line for the night was one run off three hits, one strikeout and a walk.

Cole was spot on in a win over Boston last week. He looked to be in command early Friday, dialing up a four-seam fastball that consistently topped 100 mph.

The pitch was there for him in the third inning when he was nursing a 1-0 lead and the Red Sox got two on with one out. He used two triple-digit heaters to punch out both Xander Bogaerts and Devers on 3-2 pitches.

But things changed in the fifth when Kiké Hernández got on with a one-out single. Jarren Duran then battled for six pitches before driving a liner into center that bounced into the seats for a ground-rule double.

Bogaerts was next and lifted a sacrifice fly to right field that scored Hernandez. Devers then made it 3-1, lifting his 25th homer of the season just over the top of the Green Monster.

TRAINER’S ROOM

Yankees: C Gary Sánchez left with mid-back spasms. Boone said they'll check his status Saturday... Pitchers Nestor Cortes and Jonathan Loaisiga were reinstated from the COVID-19 IL. To make room on the roster, RHP Darren O’Day was transferred to the 60-day IL and RHP Nick Nelson was optioned to Triple-A Scranton/Wilkes-Barre. 3B Gio Urshela could be activated for Sunday’s finale. OF Aaron Judge and C Kyle Higashioka may be ready for the opener of New York’s series at Tampa Bay.

Red Sox: Placed RHP Hirokazu Sawamura on the 10-day IL with right triceps inflammation and recalled Valdez from Triple-A Worcester.

ELITE COMPANY

At 24, Devers is the first Red Sox player under the age of 25 with 25 home runs and 25 doubles before August. He's also the 33rd player to hit 100 home runs with the Red Sox, but only the third to do so before 25. Ted Williams (127) and Tony Conigliaro (124) are the others.

UP NEXT

Yankees: RHP Jameson Taillon (5-4, 4.60 ERA) will make his 19th start of the season. He earned his fifth win last week against Boston, tossing 5 1/3 scoreless innings.

Red Sox: RHP Nathan Eovaldi (9-5, 3.57) leads Boston starters in wins, ERA, innings (108.1) and WHIP (1.20).

___

More AP MLB: https://apnews.com/hub/MLB and https://twitter.com/AP_Sports