Stuck On You is more of a giggle riot than the gala of gross-out gags usually associated with the Farrelly Brothers. There are carefully doled-out bits of surprising raunchiness, but the film’s core is a sweet, subdued relationship.

In their best film since There’s Something About Mary, the Farrellys find the perfect middle ground for their modulation into territory that’s raunchy but righteous. There are no overcooked crime plots (Me, Myself and Irene) or knee-slapping diversions into a pediatric burn ward (remember that from Shallow Hal?).

Instead, the brothers write, well, about brotherly love and their first-person affection for the material makes it a marvelous, low-key valentine. It helps that the weirdest sibling casting this side of Schwarzenegger and DeVito pays off positively.

As conjoined twins Bob and Walt Tenor, Matt Damon and Greg Kinnear convey a simple, sincere connection that’s as hard to sever as the nine-inch lump of skin combining their bodies together. Living in Martha’s Vineyard, The Tenors (with just one early gag on their name, as it should be) seem to excel at everything — tending hockey nets, short-order cooking and boxing, to name a few.

But while they share a liver, their personalities couldn’t be more different. Mousy Bob suffers panic attacks, never makes it with the ladies and is content to stay in the Northeast, chatting with his online “girlfriend” May (Wen Yann Shih).

Walt, though, is an outspoken actor hoping to hit it in Hollywood, which Bob goes along with given their longstanding pact to never keep each other down. An unexpected encounter with Cher leads them to a posh primetime TV gig. But public perception of the brothers as a mere gimmick wears them down, prompting talk of separation surgery that won’t harm Bob but may kill Walt.

Damon and Kinnear bring a just-go-with-it mentality to the entire movie — the physical bits, the verbal gags and, making them convincing as brothers, their relationship together. They might not necessarily like one another all the time, but each is willing to make sacrifices for the other. The brothers aren’t pious about it, and neither is the movie.

Surprisingly nimble at physical comedy (and a Mike Tyson impersonation), Damon hits all the right neurotic notes. And Kinnear will perhaps never get the true mainstream success he deserves, but his work in a segment where Bob and May finally meet is a perfect mix of deadpan laughter and true caring.

Some jokes stall flat-out, namely a gag about Walt’s first movie role and a final musical number for which another Oscar-winning actress besides Cher is really, really game. But even in the inevitable dramatic moments, the Farrellys have a strong, simple command over the movie, endowing it with the right amount of goofiness, heart and well-placed Rolling Stones ballads.

But their sly, college-humor eye is still there. Check out the pornographic play on the title of Catch Me If You Can on a theater marquee, one line of Walt’s dialogue in a sex scene and the use of perineum and smegma in the same sentence. (They have to do with the body. Just look them up.)

In Stuck On You, the Farrellys tackle something sweeter and more personal than they have in the past. But it doesn’t mean they have to suffer any separation anxiety from what makes their films fun.