BOSTON — In the eighth inning of Thursday night’s game against the Yankees, Hanley Ramirez was writhing on the ground in pain after colliding with New York Yankee rookie Gary Sanchez.

Friday night, though, it was Arizona right-hander Patrick Corbin who felt Ramirez’s pain.

Ramirez hit three-run homers off Corbin in each of the first two innings and David Price won for the first time in more than a month as the Boston Red Sox ended the Arizona Diamondbacks’ four-game winning streak with a 9-4 victory in the opener of a three-game interleague series.

Red Sox manager John Farrell said Ramirez, who didn’t hit in the ninth inning after injuring his lower back Thursday, let him know early in the day he would play Friday. Ramirez then hit his 15th and 16th homers of the year to stake Boston to an 8-2 lead.

David Ortiz also had two hits in the first two innings, one driving in a run, and then blasted a solo homer (No. 26) in the seventh as the Red Sox won for just the second time in six games.

Ortiz reached 90 RBIs for the 12th time in his career — and the extra base hit was his 1,000th with the Red Sox.

Price (10-8) gave up a two-run homer to Rickie Weeks in the first and settled in for his first win in six starts. He yielded a solo homer to Tuffy Gosewisch (his second home run in as many days) and went eight innings, allowing 10 hits. On his final pitch, right fielder Mookie Betts hauled in a near homer by Jake Lamb.

Reliever Fernando Abad gave up a run in the ninth.

Corbin (4-12) lasted 1 2/3 innings and has gone 0-6 with three no-decisions in his last nine starts.

A bizarre first inning saw the Red Sox take a 4-2 lead.

Arizona’s Jean Segura opened with a gift triple when Jackie Bradley Jr. tripped and fell in the outfield on the first pitch. On the next pitch, Phil Gosselin lofted a fly to short center. Bradley got a late jump, made a shoestring catch and fired a strike home. Segura came down the line a bit too far and Bryan Holaday relayed Bradley’s throw to third to nail Segura.

Paul Goldschmidt singled and Weeks hit his sixth homer of the year.

Segura opened the bottom of the frame with only his sixth error in 109 games, but made an outstanding running over-the-shoulder grab of Betts’ pop fly. However, the error led to four unearned runs as Ortiz singled, Ramirez hit a three-run homer and third baseman Jake Lamb made another error to lead to the fourth, which was driven in by Holaday.

Ortiz singled home a run and Ramirez hit his second three-run shot to make it 8-2 in the second as Corbin was chased.

Gosewisch led off the Arizona fifth with a long homer.

NOTES: Boston 2B Dustin Pedroia left after two innings because of flu-like symptoms. … The Diamondbacks transferred C Welington Castillo from the paternity to the bereavement list because of complications in the birth of his second child. … Red Sox manager John Farrell said RHP Steven Wright’s right shoulder has improved and the hope is he can take his next turn Thursday. … Boston RF Mookie Betts (quad, injured Wednesday) and 1B Hanley Ramirez (back, Thursday) were back in the lineup. … Diamondbacks RF Yasmany Tomas missed his fifth straight game with a neck injury but could return Saturday night, when RHP Archie Bradley faces Red Sox spot starter RHP Clay Buchholz in Game 2 of the series. It will be Buchholz’s first start since July 2. … RHP Rubby De La Rosa, out since May 25 with an elbow injury, suffered a setback with forearm tightness that will require an MRI.