A tumultuous, up-and-down first half of the season came to an end Sunday for the Yankees, and the All-Star break couldn’t arrive at a better time for them.

With the Yankees having lost 18 of their last 25 games, the four-day respite could be helpful, and a handful of the team’s injured veterans are on track to return in the near future.

The first series out of the break is a four-game set starting Friday night in Boston against the AL East-leading Red Sox, who hold a 3 1⁄2-game lead over the Yankees and Rays. On June 12, the Yankees led the Red Sox by four games and the Rays by 6 1⁄2. Since the Yankees’ skid began on June 13 on the road against the Angels, Boston has gone 15-11 and Tampa Bay has gone 13-11 to the Yankees’ 7-18.

“It’s a really significant trip for us because we have to start playing better,” Joe Girardi said before watching Masahiro Tanaka allow two home runs and five runs in 4 1⁄3 innings in a 5-3 loss to the Brewers on Sunday at Yankee Stadium. “We’re going to start to get some of our guys back, which we hope leads to that as well. It’s an important road trip, but it’s not an end-of-the-world road trip because you’re still going to have 60 or so games left after that road trip.”

The Yankees play 11 games in 10 days starting Friday, with a split doubleheader against Boston scheduled for Sunday. Three games in Minnesota and four games in Seattle follow.

“Every series is crucial, but especially playing the Red Sox, they’re in first place right now, so it’s going to be big for us,” Aaron Judge said. “If we just go out there and play our game, I think good things will happen.”

advertisement | advertise on newsday

A six-game winning streak in mid-June had the Yankees a season-best 15 games over .500 at 38-23. Now they’re 45-41 and have a negative-19 run differential in the last 25 games.

“The big thing is, we need to play better,” Girardi said after Sunday’s game. “You can’t worry so much about where you are. We have to go out and play better, and we just haven’t done that lately.”

Help could be on the way in the form of Matt Holliday, whom Girardi said he expects back on Friday after a stint on the disabled list with a viral illness. Starlin Castro, on the DL with a hamstring injury that occurred on June 26, could play rehab games next week, Girardi said.

CC Sabathia, who returned last week, threw a simulated game Sunday.

Holliday’s return will be a boon for a team that went 1-for-16 with runners in scoring position Sunday, and the Yankees know the importance of starting the nominal second half strongly.

Yankees videos

Just how big is the series?

“Huge series,” Clint Frazier said.