CHICAGO — Lance Lynn turned off the television in his Chicago hotel room late Sunday night and knew what was in front of him Monday evening.

He watched Aroldis Chapman flush a three-run lead in the ninth to the Red Sox, who swept a four-game series from their blood rivals an inning later. While his teammates traveled from Boston, Lynn went to sleep.

“I went to bed knowing I had to show up [Monday],” Lynn said after leading the Yankees to a much-needed 7-0 victory over the horrific White Sox in front of 22,084 at Guaranteed Rate Field.

Acquired on July 30 from the Twins, the 31-year-old right-hander knew he was being asked to help halt a five-game slide, the longest losing streak of the year for the Yankees.

Lynn spent six years with the Cardinals and the first half of this season with the Twins, so he is well aware working for the Yankees isn’t like any other shop.

He knew a five-game losing streak in early August was a bigger deal than it might have been in other cities.

“Normally I would say no,’’ Lynn said when asked if he felt pressure to pitch well after the lost weekend in Boston. “But when you play for the Yankees it is a little different. I came into this start knowing I needed to do my job.”

After a shaky first inning in which he needed 27 pitches to record three outs, Lynn overpowered the White Sox hitters with a mix of four-seam fastballs up and two-seamers down. In 7 ¹/₃ scoreless innings, Lynn allowed two hits, walked one and tied a season high by striking out nine.

With two runners on in the first Lynn struck out Avisail Garcia to start a string of 19 consecutive outs.

“I tried to move it in and out and make them uncomfortable and mix in some curveballs,’’ Lynn said of his signature fastballs.

Early it looked like the hitting malaise that smothered the Yankees in the middle two games in Fenway Park had traveled west because right-hander Dylan Covey, a pitcher with a 5.57 ERA and a 4-7 ledger, retired the first 10 hitters.

That stopped when Giancarlo Stanton walked with one out in the fourth. Didi Gregorius followed with a double, Aaron Hicks’ single scored Stanton and Gleyber Torres singled in Gregorius. The Yankees scored twice in the fifth when Gregorius singled in a run and Kyle Higashioka scored on a wild pitch. Torres and Neil Walker homered in the eighth when the Yankees tacked on three more runs.

The victory moved the 69-42 Yankees to nine games back of the AL East-leading Red Sox and extended their lead over the A’s to three lengths in the race for the top AL wild-card spot.

Short outings by starters weren’t the only reason the Yankees had dropped five straight, which may have cost them a chance at the divisional title. However, those abbreviated starts played a big part. During the skid, the starters combined for 21 innings. In the four games against the Red Sox it was just 18 ¹/₃ innings.

Lynn was the first starter to work into the seventh since Masahiro Tanaka went nine on July 24 against the Rays in St. Petersburg, Fla.

“He likes to use a lot of fastballs and we decided to stick with it the whole game. When stuff is working you don’t want to change it,’’ said Higashioka, who explained Lynn was very simple to catch because of the fastball command. “Knowing the stuff he’s got I am not surprised how well he did. He is relatively easy to call a game for.’’

One win over a brutal club doesn’t mean the Yankees are ready to reel off an extended winning streak. Nor does it mean Lynn is going to morph into vintage Roger Clemens. Yet watching Lynn pitch and the bats come alive, albeit against pedestrian pitching, made the Yankees feel a lot better than when they left New England on Sunday night.