"Silicon Valley" star Thomas Middleditch says that swinging saved his marriage.

The 37-year-old actor confessed to Playboy that not long after their wedding in 2015, he asked his wife, Mollie Gates, for an open relationship.

"I don’t know how much I can say, because I don’t want my wife to be mad at me. Only after I got married was I like, 'Mollie, I’m sorry, but we have to get nontraditional here.' To her credit, instead of saying 'F—k you, I’m out,' she was like, 'Let’s figure this out,'" he said. "To be honest, swinging has saved our marriage. We have different speeds, and we argue over it constantly, but it’s better than feeling unheard and alone and that you have to scurry in the shadows."

FLORIDA SWINGERS CLUB ORDERED TO PAY MODELS NEARLY $1 MILLION FOR ALLEGEDLY SWIPING PHOTOS

Middleditch said he thought his urges to sleep with other people would end once he got married, but they didn't. Once he and Gates agreed to be "part of the lifestyle," he says it sometimes gets tricky because he's a celebrity and has women throwing themselves at him fairly regularly.

EUROPE'S BIGGEST SEX FESTIVAL HITS ENGLAND

WEST HOLLYWOOD, CA - MAY 09: Thomas Middleditch (L) and Mollie Gates attend the Los Angeles Special Screening of A24's

Thomas Middleditch and wife Mollie Gates have an open marriage. The "Silicon Valley" star says swinging saved their relationship. (Getty)

'SWINGLAND': HOLLYWOOD WRITER'S SWINGING LIFESTYLE RESULTS IN REJECTION, INJURY AND LOTS OF SEX

"Personally, that’s one of the trickier elements of it all, because Mollie doesn’t get that and yet she has to witness it. I’m like, 'Come on, what about this chick who’s obviously really into me?' And Mollie will say,'Yeah, she’s into you. Where do I fit in?' That question comes up," he said. "There’s a lot of negotiation, and adding fame sometimes makes it easier and sometimes complicates things."

MICHIGAN COUPLE SUES TOWNSHIP OVER SWINGERS CLUB OPENING

The "Godzilla: King of the Monsters" star explained that his first priority is his wife, whom he adores, and that their methods for finding partners vary: They've done sex parties, but social media can make hookups more difficult, if more available, because of the trust involved.

SWINGERS CLUB IN FLORIDA SUED IN CONNECTION TO CAR CRASH

"That’s the forever-changing landscape in our relationship, because it’s about everybody feeling safe. The internet is a possibility for meeting people, but Instagram f—ks up marriages," he continued. "If your partner brings this very forward person from Instagram to you, you’ll be like, 'Do you guys have a thing?' Whereas if your partner bumps into someone and they start a conversation, it all happens in front of you."

CLICK HERE TO GET THE FOX NEWS APP

"It’s a game of inches on a minefield to try to predict who’s going to feel safe," he said. "My first concern is Mollie. Anything that happens has to be run by the queen."