KANSAS CITY, Mo. — Mookie Betts is pretty good against Danny Duffy.

Betts hit a two-run homer off Duffy in a four-run third inning Thursday and the Boston Red Sox defeated the Kansas City Royals 7-5 to complete their first series sweep in nearly a month.

Betts is 7 for 11 with five home runs against Duffy (3-3).

“I put some good swings on some good pitches,” Betts said.

Betts has six hits, five home runs and a walk in his last seven plate appearances against Duffy.

“I’ve got to a better job of not serving it to him on a platter,” Duffy said. “He’s got five bombs against me in 11 at-bats. … If you make stupid mistakes like that he’s going to capitalize.”

Boston outscored the Royals 23-8 over three games and extended its winning streak to four. The Red Sox swept a series for the fourth time this year, the first since May 10-12 against the Chicago White Sox. They are 27-16 following a 6-13 start and face the second-place Tampa Bay Rays in a four-game weekend series at Fenway Park.

“We have some confidence going against a really good ballclub,” Betts said. “Ride the wave through this weekend.”

Kansas City has lost six straight and 9 of 10, dropping to a big league-worst 19-43.

With a doubleheader coming up Saturday against Tampa Bay, Boston gave Ryan Weber his third start. He allowed two runs and five hits in 1 1/3 innings, and Colten Brewer (1-2) followed with two scoreless innings of two-hit relief.

Matt Barnes, Boston’s seventh pitcher, allowed Jorge Soler’s one-out RBI double in the ninth but got his fourth save in seven chances by striking out Ryan O’Hearn and Chelsor Cuthbert.

Duffy allowed four runs and four hits in 2 1/3 innings. Eduardo Nunez’s hard drive went off the inside of Duffy’s right kneecap and ricocheted to O’Hearn, who tagged Nunez for the final out of the second. Duffy retired one of the six batters he faced in the third.

“It’s sore but it didn’t affect me,” Duffy said. “If I go back out there it’s because I can. If I can, there are no excuses.”

Betts’ 10th home run tied the score and Rafael Devers put Boston ahead with a two-run single.

Soler’s fifth-inning homer cut the deficit to 4-3, but Christian Vazquez hit a two-run triple in the seventh and scored on Scott Barlow’s wild pitch.

Cuthbert and Alex Gordon homered for the Royals.

TRAINER’S ROOM

Red Sox DH J.D. Martinez was removed in the fifth inning because of back spasms. … Left-hander Brian Johnson, on the injury list since April 6 because of elbow inflammation, will make his sixth minor league injury rehab appearance Sunday.

UP NEXT

Red Sox: Right-hander Rick Porcello (4-5, 4.76 ERA) starts Friday’s opener of a four-game series against visiting Tampa Bay.

Royals: Right-hander Homer Bailey (4-6, 6.05 ERA) takes the mound Friday at home against the White Sox.