Lucas Giolito was rolling, feeling as comfortable as he has all season. It was just what the White Sox needed.

Giolito pitched into the eighth inning before Xavier Cedeno worked out of a jam, and Chicago snapped an eight-game losing streak by beating the Oakland Athletics 6-4 Friday night to salvage a doubleheader split.

The White Sox bounced back after getting pounded 11-2 behind a pair of three-run homers by Franklin Barreto. They stopped their worst skid since a nine-game rut last July and ended Oakland’s season-high win streak at five.

Giolito (5-7) allowed four runs and seven hits in a rare home win. The 23-year-old right-hander struck out eight and walked two after going 1-4 with an 11.05 ERA in his first seven starts at Guaranteed Rate Field.

A lot more conviction in his pitches, manager Rick Renteria said.

Olson went deep for Oakland, giving the Athletics home runs in 23 consecutive road games — one shy of the modern day record set by Baltimore in 1996. But Chris Bassitt (0-3) got tagged for five runs and six hits in 5 1/3 innings.

Barreto’s big performance in the opener came after he hit a three-run drive in Wednesday’s romp at San Diego.

He connected against James Shields to cap a four-run second inning and off Luis Avilan in the eighth . Barreto’s first career multihomer game gave him a personal-best six RBI.

Secretly, I was hoping something special would happen. I want to be able to tell BabyGirl (we haven’t settled on a name yet) about the time we took her to her first baseball game, and this amazing thing happened. I wanted to tell her it was baseball’s way of welcoming her to the world. Silly, right? I don’t care. I want amazing for her. That will never change.

Through three innings, I thought Cardinals rookie Jack Flaherty just might deliver that amazing. He retired the first nine Phillies he faced with relative ease, striking out four in a row at one point. Could this fresh-faced rookie give BabyGirl a perfect game? A no-hitter, at least? I haven’t seen either in person yet. It was only the third inning, but I had hope.

Damn Rhys Hoskins. He ended that hope with a no-doubt home run with one out in the fourth inning. After the hiccup, Flaherty continued to roll through the Phillies, though, and by the time he was done, he had struck out 13 batters in 7 2/3 innings. It was an incredibly impressive performance for just his fourth start of the season and the ninth of his major-league career.