NEW YORK -- David Ortiz homered twice, passing Hall of Famer Carl Yastrzemski for second place on Boston's career list, and Steven Wright pitched a three-hitter as the Red Sox beat the New York Yankees 5-1 on Sunday night.

Dustin Pedroia hit an early two-run homer and Xander Bogaerts also went deep for the Red Sox, who prevented a three-game sweep and won for the fourth time in six meetings with their longtime rivals this year.

In his farewell season, the 40-year-old Ortiz has been a New York nemesis as usual. He has five home runs against the Yankees since April 29, giving him 52 in his career -- all but one with the Red Sox.

More from FoxSports

Wright (3-3) walked one and struck out seven, breezing to his first complete game in 17 major league starts. He was two strikes from a shutout, too, when Brett Gardner homered with two outs in the ninth inning.

The right-hander hardly got rattled, whiffing pinch-hitter Ronald Torreyes with his 101st pitch to end it.

Only 4 players have hit more career home runs against the Yankees than @davidortiz. pic.twitter.com/8cFfQMyyjU

— MLB Stat of the Day (@MLBStatoftheDay) May 9, 2016

Mixing his 73-75 mph knuckleballs with the occasional 87 mph fastball, Wright baffled the Yankees all night. When he threw something soft, they seemed to hit it even softer. When he dialed up a heater, they swung late and missed.

Ortiz was right on time, connecting for two long solo shots off a struggling Luis Severino (0-5). Big Papi has hit 454 of his 512 career homers with the Red Sox, moving him ahead of Yastrzemski (452) and leaving the slugger behind only Ted Williams (521).

Severino matched a career high with nine strikeouts in 6 2/3 innings, but he gave up three home runs.

TRAINER'S ROOM

Red Sox: LHP Eduardo Rodriguez (right knee) threw 93 pitches in his third rehab start for Triple-A Pawtucket. He gave up three earned runs and six hits, including two homers, over 5 2/3 innings against Rochester. Boston manager John Farrell said the team will meet with Rodriguez on Monday at Fenway Park, and the pitcher's next start could be in the majors. "I wouldn't rule it out," Farrell said. ... RHP Joe Kelly (shoulder impingement) is scheduled to make his second rehab start Wednesday for Pawtucket. "We'll look to advance him to 80-85 pitches," Farrell said. ... RHP Sean O'Sullivan, called up from Pawtucket on Friday, is likely to make a spot start Tuesday night against Oakland, Farrell said.

#BigPapi ♥️'s Yankee Stadium. #RedSox

HR No. 1: https://t.co/GrLx9EK8pr

HR No. 2: https://t.co/er28IpH4ew pic.twitter.com/BZuMNp432y

— Boston Red Sox (@RedSox) May 9, 2016

Yankees: CF Jacoby Ellsbury missed his second straight game after straining a hip muscle Friday night and probably won't be ready to play Monday night, manager Joe Girardi said.

UP NEXT

Red Sox: RHP Clay Buchholz (1-3, 5.71 ERA), coming off a strong outing against the Chicago White Sox, starts Monday night versus Oakland ace Sonny Gray (3-3, 4.84) in the opener of a seven-game homestand.

Yankees: All-Star reliever Aroldis Chapman is set to be activated after serving a 29-game suspension under baseball's domestic violence policy. Ready to make his Yankees debut, he'll join the team for the opener of a four-game home set against World Series champion Kansas City and immediately take over as closer in an imposing bullpen that already features Dellin Betances and Andrew Miller. Ivan Nova (1-1, 5.14 ERA) makes his first start of the season in place of injured CC Sabathia.