Tim Locastro #33 of the New York Yankees celebrates his...

Tim Locastro #33 of the New York Yankees celebrates his fourth inning two run home run against the Boston Red Sox with teammate Aaron Hicks #31 at Yankee Stadium on Sunday, July 17, 2022 in the Bronx borough of New York City. Credit: Jim McIsaac

The rare dip into a pool of losses was over. The Yankees went into the All-Star break standing up instead of sliding, reversing their five-of-six skid with two one-sided wins over Boston.

They emerged with a 13-2 win in Sunday’s finale at Yankee Stadium, which followed Saturday night’s 14-1 win.

“You want to roll into the break feeling good,” Aaron Boone said. “Good to see the guys finish off a strong half.”

Aaron Hicks knocked Red Sox lefthander Chris Sale out of the game with a 106.7-mph line shot that broke his left pinkie in a three-run first. Tim Locastro, recalled Saturday from Triple-A for his second stint of 2022, delivered three hits, including a two-run homer to cap an eight-run fourth, and stole two bases.

The legend of Matt Carpenter continued. He had a two-run double and finished with three RBIs, giving him 34 in 21 starts.

Gerrit Cole (9-2, 3.02 ERA) tied a season high with 12 strikeouts in seven innings, allowing two runs, four hits and no walks.

DJ LeMahieu scored three runs and had three hits, making him 17-for-45 in his last 11 games.

So the Yankees can look back with satisfaction at a special first half that featured the franchise record for wins before the break. They’re a major league-best 64-28 and own a 13-game cushion over the second-place Rays in the AL East.

Boone saw a common thread woven through their uncommon stack of victories. “The ways we’ve been able to win games and the confidence that this team has that we can win in any kind of way,” he said. “That’s really what’s jumped out.”

But .  .  .

“We’ve got to continue to work at being more consistent,” he said.

Cole was consistent enough to make the AL All-Star team. He was replaced on that roster Sunday because he started this game, but he will attend.

For a change, Cole didn’t serve up a homer to Rafael Devers. The All-Star third baseman had hit six off Cole, including two on July 7 at Fenway Park. But Devers went 0-for-3 with two strikeouts after Cole sent him sprawling with an inside fastball at knee level in the first.

“I don’t think I figured him out,” Cole said. “I executed the pitches that I wanted to execute today, and I think we sequenced better than we did last time.”

The first inning went badly for Boston, which wound up striking out 16 times.

Sale missed the first 87 games with a rib fracture. This was his second start, and it didn’t last long.

After two runs scored on a throwing error by Devers and Carpenter’s groundout, Hicks smacked a two-out bullet right at Sale’s left hand. The ball deflected into rightfield for an RBI single and Sale immediately walked toward the dugout, his left pinkie awkwardly extended.

“Honestly,” Cole said, “we were all kind of sick about it.”

Jeter Downs, who entered the at-bat hitting .136, rocked a two-run drive off Cole in the third for his first career homer, bringing the Red Sox within 3-2.

Then came the fourth.

Let’s roll the highlights: Locastro leadoff single and a steal, his second of the game; LeMahieu RBI single; Aaron Judge RBI single; Carpenter two-run double, giving him 10 RBIs in the last two games; Hicks RBI single; Isiah Kiner-Falefa sacrifice fly; Locastro 410-foot two-run homer into the Red Sox bullpen for an 11-2 lead.

“Timmy was kind of the spark of that,” Boone said.

Joey Gallo, who entered with four hits in his previous 55 at-bats and 27 strikeouts, added a two-run homer in the seventh.

“It’s always nice to beat your rival,” Locastro said. “We accomplished what we wanted to do, and we’re on to the second half now.”

More Yankees headlines