Aaron Judge of the Yankees celebrates with Gleyber Torres after...

Aaron Judge of the Yankees celebrates with Gleyber Torres after the Yankees defeat the Red Sox at Fenway Park on Wednesday. Credit: Getty Images/Maddie Meyer

MILWAUKEE — It’s a form of an old coaching axiom and it goes something like this: You’re never as good as you think you are when you’re winning or as bad as you think you are when you’re losing.

The Yankees have experienced both extremes this season.

A historically good start the first three-plus months of the season led to premature comparisons to the all-time 1998 championship team as the Yankees built a 15 ½-game lead over the Rays in the American League East by bursting from the gate at 61-24.

But a 22-32 stretch followed, culminating in last Friday’s loss at home to the Rays that shaved the lead to 3 ½ games.

Throughoutmost of that stretch, Aaron Boone, the Yankees’ uber-positive manager, maintained his club, even as injuries and losses mounted, wasn’t too far away from recapturing their first-half form.

"We've done it most of the year. I have total faith in that room and those players," Boone said after a loss to Toronto Aug. 20 dropped his team to 5-12 in a month it ultimately would finish at  10-18. "We've got more than our share of struggling right now. But we've got to find a way. I don't really care about the number [of the division lead). If we play like this and keep walking away at the end of the night, it ain't going to matter. If we get it together and play our game, then we'll run away. So eight, nine, 10, seven, five, we've got to play better. We've got to start racking up some wins.”

After, perhaps, reaching their nadir of the season in last Friday’s loss to the Rays – a game most remembered for Aaron Hicks getting pulled mid-game after misplaying two balls in the field – the Yankees have started racking those wins back up.

In completing a two-game sweep of the Red Sox Wednesday night with a 5-3 victory, the Yankees made it four straight victories and eight wins in their last 10 games. The Yankees, off Thursday before starting a three-game series against the Brewers here, have built their lead in the East back to 6 1/2 games over the Blue Jays (and 7 over the Rays).

“We’re getting better, we’re getting healthier,” Boone said in Boston. “More help’s on the way.”

In the last week, the Yankees returned Giancarlo Stanton (from the injured list) and Josh Donaldson (from the paternity list), and within the next week could be getting first baseman Anthony Rizzo, centerfielder Harrison Bader, relievers Aroldis Chapman and Scott Effross and starter Luis Severino back from the IL. DJ LeMahieu, on this trip rehabbing a big right toe injury and hoping to start swinging a bat at some point this weekend, is a little less clear in his timeline. Also, Zack Britton (Tommy John recovery) could return soon, though, as has been the case since the spring, the Yankees were never counting on Britton to provide meaningful innings this season. Regardless, there’s no question the Yankees are getting healthier at the right time and, so far, performance has followed.

“We know what time of year it is and we know we’ve got to put our best foot forward,’’ Boone said. “So it’s been good to see guys really come together as we’re still piecing it together.”

Nestor Cortes, the most consistent member of the Yankees’ rotation this season – he improved to 10-4 with a 2.70 ERA after beating the Red Sox Wednesday – said even in the worst of times players never lost belief.

“I think the confidence never died down,’’ Cortes said. “I know we’ve gone through tough stretches and I think that’s what’s kept us stronger. What we’re doing now shows what type of team we are. I think moving forward we found our stride.”

More Yankees headlines