Matt is obsessed with his ex-girlfriend, Nicole though it's been six months since she broke up with him. His obsession makes it impossible for him to have relationships with other women. Matt confides to his brother John a priest-in-training, that he has sexual problems because of his obsession.
Realizing that Lent is about to start, Matt tells John that he's going to do without sex for 40 days and 40 nights. This, he concludes, will force him to get over Nicole and cure his problem. John warns Matt that celibacy is not easy.After about six days of being productive and happy, Matt goes out and does his laundry. At the Laundromat, he meets a very pretty girl named Erica who works for Cyber Nanny, a search engine that keeps kids from finding porn on the Internet. Matt and Erica make plans to come back and see each other next week.Meanwhile, back at the office, the women Matt works with are trying to get him to crack: Two girls make out with each other in front of Matt while another girl sits on a copier with her legs spread and photocopies her buttocks for Matt. Matt is strong, though, and doesn't give in to temptation.
When Matt and Erica do their laundry again, they make plans to go out on a date. Matt takes her on a bus ride all around the city, and rather than kiss her goodnight at the end of the evening, he high-fives her and falls backward off some stairs. The next day at work, Matt finds out about the office pool. Worse yet, it turns out that a guy at work set up a website about Matt and his vow of chastity. Even more worse, Matt sees that it's been protected by Cyber Nanny, and realizes that Erica must know about his abstinence. He goes to her office, where he finds out that she's seen the site, and she's not too happy about it.
Matt and Erica go out to dinner a few nights later, after Erica's cooled down, and Nicole and her new fiancé are there. Matt introduces Nicole to Erica, and Erica realizes that Matt's celibacy is a result of his breakup with Nicole. Matt lies and tells her that it's not true. Erica, sick of Matt's lies, leaves the restaurant.
Matt's co-workers are getting desperate to get Matt to have sex, and one guy puts some crushed Viagra into Matt's orange juice. However, their boss Jerry drinks it and goes off to the bathroom to masturbate. Another co-worker finds Matt hiding in a supply closet, shaking and sweating. He gives Matt a dirty magazine and convinces Matt to go into the bathroom and masturbate. Matt's about to, but then he hears Jerry masturbating in the next stall over, so he doesn't do anything but climb out the bathroom window and run to Erica's house.
Erica and Matt have a very erotic encounter without touching each other. Somehow, Erica actually has an orgasm, then she falls asleep and Matt goes home.
On his way to work the next day, Matt hallucinates that every woman he sees is naked. He goes to John's office at the church and finds him making out with a nun. At first, Matt thinks it's another hallucination, but, no, John couldn't remain celibate and is going to take some time off from the seminary.
Matt goes to work and starts daydreaming about his romantic encounter with Erica. A co-worker wakes him up and tells him to get into the conference room for a meeting with an important client. As Matt walks into the conference room, each of his co-workers stares at his crotch in horror and amazement. Matt enters the conference room with an erection, and Jerry points it out to Matt and tells him to go home for the day.
Nicole comes by the apartment to say that she has broken up with her fiancé. She wants Matt back, and tries to put the make on him. Matt, however, turns her down and makes her leave the apartment. Nicole leaves, saying that Matt's new assertiveness makes her hot. At the Café, she finds out about the pool and bets $3000 that she can get him to break.
At home, Matt asks Ryan to handcuff him to his bed so that he won't be able to do anything (i.e. masturbate) to ruin his vow, which is ending that night. Ryan does so, and leaves the door unlocked so that Erica can let herself in when she comes by for their date later that night. Matt falls asleep, handcuffed to his bed, and dreams about breasts. He wakes up to find Nicole finishing herself off on top of him. She placed a bet with Matt's co-workers, and it seems she's just won the pool. Erica arrives as Nicole is leaving, and puts two and two together. She storms off, leaving Matt handcuffed to the bed posts.
Matt puts together a little box of reminders of their relationship and leaves it with Erica's roommate. Erica looks at the box, has a change of heart, and goes to the Laundromat. Matt shows up, and they kiss passionately and live happily ever after.