Alison Brie and Jason Sudeikis play a couple who meet at a sex addiction support group and decide to keep their relationship platonic in writer-director Leslye Headland’s “Sleeping With Other People.” (Linda Kallerus/IFC Films)

Jake is a womanizer so shameless that one of his exes pushes him in front of an oncoming taxi. Lainey can’t stop sleeping with her college crush, even though the guy is engaged to someone else and she has a boyfriend. When Jake and Lainey bump into each other — at a sex addiction support group — sparks fly. They’ve met once before, more than a decade earlier, the night they lost their virginities to one another.

Naturally, two people with impulse-control issues and a romantic history decide not to go home together. They’re just going to be friends.

Right.

That’s the somewhat far-fetched premise of “Sleeping With Other People.” The romantic comedy boasts two winning leads in Jason Sudeikis and Alison Brie, as well as some sweet, funny moments amid the Aaron Sorkin-esque dialogue — courtesy of writer-director Leslye Headland — that’s a little too clever for its own believability.

Headland is the playwright behind the dark comedy “Bachelorette,” a raunchy, sometimes mean-spirited examination of female friendships, which she adapted for the screen in 2012. Thankfully, “Sleeping With Other People” doesn’t have the same hard edges as the earlier film. It’s still plenty filthy, though.

Case in point: Jake teaches Lainey how to masturbate using a glass bottle as a demo. Not all of the pair’s interactions are quite so, er, charged. They spend much of the movie wandering around New York, “When Harry Met Sally”-style, shopping for electronics, hitting their favorite Chinese restaurant and strolling through Central Park, all the while discussing their latest romantic conquests. This utterly confounds their best friends, especially Jake’s buddy Xander (Jason Mantzoukas) and Xander’s wife, Naomi (Andrea Savage), who very nearly steal the movie. (Be sure to stay for the closing credits, when the pair’s riffing provides some of the comedy’s funniest moments.)

But the friendship also seems to be helping Jake and Lainey deal with their respective commitment issues. Suddenly Jake doesn’t have the same compulsion to bed every woman in Manhattan. And Lainey isn’t so drawn to her longtime crush, a saltine cracker of a love interest, who’s so bland that actor Adam Scott seems to have had his personality surgically removed in order to play him.

Why Lainey would be enamored by such a dud remains a mystery. So is the reason why Lainey would model lingerie for Jake, considering that the two are trying to keep things platonic.

These questions tend to fall away thanks to the engaging stars. Sudeikis has impeccable comic timing and almost makes his rat-a-tat-tat dialogue sound natural. Brie’s portrayal of a compulsive, damaged woman verges on shattering at times.

In a somewhat fresh take on the romantic-comedy formula, the movie focuses not so much on how it feels to fall in love as what it looks like when two self-sabotaging people learn what love really means. In an age of hookup culture, that’s a worthy distinction. The film’s depiction of it, despite some phoniness, rings true.

R. At Landmark’s Bethesda Row and Landmark’s E Street. Contains sexual content, coarse language including sexual references and some drug use. 95 minutes.