– The Twins’ final road series is being staged here this weekend, their final chance to indulge in a season-long habit: Giving up walk-off home runs.

They weren’t going to miss the opportunity to make history.

Khris Davis blasted a cutter from Matt Magill over the center field wall in the 10th inning Friday night, his MLB-leading 45th home run and second of the night, to deliver the Athletics’ 7-6 victory over the Twins. It was the 10th walk-off homer the Twins have allowed this season, making them the first team in MLB history to reach double digits in that dubious category.

“Davis, a guy you kind of want to avoid beating you, hits a couple of homers,” Paul Molitor said ruefully after Minnesota’ four-game losing streak was snapped. “So it’s just not quite executing as well as we needed to.”

And just think: They have two more road games to put their record out of reach.

The Twins embarked on this trip having been victimized by the walk-off homer eight times this season, tying them with the 2010 Cardinals for most ever in a single season. Salvador Perez’s grand slam off Trevor Hildenberger in Kansas City exactly one week earlier gave them the record. And Davis-off-Magill made it an even 10.

The Twins have also lost 14 games this year in walk-off fashion, homer or not. That’s one away from the franchise record of 15, set in 1964 — and just two away from the MLB record of 16, held by five teams, most recently the Giants in 1979.

There had been “not too many as of late. We certainly had a high number in the first half,” said Molitor, whose team allowed six walk-off homers before June arrived.

If the big blast was painful for the Twins, it was critical to the A’s, who remained 1 1/2 games behind the Yankees for home-field advantage in their inevitable wild-card playoff game once the season ends.

Davis’ homer came on Magill’s third pitch to Davis. “Slider first pitch just missed, he came back with a cutter and got a checked swing,” Molitor said. “He tried it again and didn’t get it to the same spot.” He didn’t, but Davis did — his second home run landed just a few feet short of the first one, just to the right of straightaway center.

Jose Berrios pitched into the sixth inning and struck out eight, but for the eighth consecutive game, he walked away without a victory. He probably didn’t deserve one anyway, considering the A’s scored in four of the six innings.

“He struggled with command today, but he hung in there,” Molitor said. “He gave us a chance.”

Berrios whiffed the first two batters of the game, but then walked Jed Lowrie, a bad mistake considering Davis was on deck. Sure enough, Davis launched a fastball off the wall beyond the center-field fence, his 44th homer of the season.

“I felt strong out there. My only mistake was that pitch to Davis, and he hit it out,” Berrios said. “The other things were a couple of hits here and there. Nothing hard-hit besides that one. But it’s just how it goes.”

Berrios also allowed the A’s to add to their lead on sacrifice flys by Jonathan Lucroy in the second inning (after two singles) and Marcus Semien in the fourth (after a single and a hit batter). He allowed just four hits but three walks in his 5 1/3 innings.

The Twins staged one of their biggest rallies of the season, swamping the Athletics’ 4-0 lead against Berrios with a six-run sixth. After a leadoff double by Jake Cave off A’s reliever Lou Trivino, Robbie Grossman cracked Trivino’s first pitch to him — a 97-mph fastball right down the middle — into the right-field seats, his first home run since July 2, 184 plate appearances ago.

The homer seemed to ignite the Twins, because Max Kepler and Tyler Austin followed with singles, driving Trivino from the game, and Ehire Adrianza doubled a run home against Shawn Kelley. Two straight batters lifted shallow fly balls to A’s right fielder Stephen Piscotty, and Austin had to hold on third base. But after an intentional walk to Joe Mauer loaded the bases, Jorge Polanco drove a 2-2 fastball to the center field wall, bringing home all three runners to stake the Twins to an unexpected 6-4 lead.

It didn’t last long. Berrios walked Piscotty to open the bottom of the inning, but after back-to-back strikeouts, his pitch count reached 104, and manager Paul Molitor replaced Berrios with lefthander Gabriel Moya to face pinch-hitter Matt Canha. Moya got two quick strikes, but on 2-2, left a low changeup in the middle of the plate. Canha golfed it beyond the left-field wall, tying the score and extending Berrios’ winless streak.

No regrets, Molitor said, of pulling his starter.

“I wasn’t sure it would be Canha or [Chad] Pinder, I knew it would be one of those two guys,” Molitor said. “I still preferred that [over] Joyce vs. Berrios at that time. Didn’t work out.”