Annie Hargrove (Cameron Diaz) is a 30-something blogger who starts off her latest post by asking readers if they remember the first time their man saw them naked. She recounts the earlier years she had with her boyfriend Jay (Jason Segel) when they were constantly having sex, regardless of who's watching or where they were. It reached the point where Annie got pregnant and she married Jay. As they had two kids, their time for sex just disappeared, and even as they look at each other naked today, even Annie doesn't want to think about it. She muses as to how they can get that drive back into their lives.
Today, Annie and Jay have to deal with their bratty, ill-behaved son Clive (Sebastian Hedges Thomas) and their younger daughter Nell (Giselle Eisenberg). Even the two children can see that their parents are feeling bored at home. After dropping them off at school, Jay goes to work at a radio station where he talks to his friend Max (Nat Faxon) about Max's girlfriend and their sexting to each other while also commenting on how weird it is that Jay sends Annie pictures of his penis. Their assistant comes in and brings two iPads for Jay, since he uses separate tablets for different tasks. Any other he has left are given away.
Meanwhile, Annie goes to the Piper Brother company where a team led by Hank Rosenbaum (Rob Lowe) are looking to purchase Annie's blog, despite some of the content she puts in her posts (mentioning Jay's erections multiple times, for instance). Still, Hank is very enthusiastic about bringing Annie on board.
To celebrate, Annie calls her mother Linda (Nancy Lenehan) to take Clive and Nell to her house so that Annie and Jay can have the house to themselves. Annie surprises Jay by dressing in a see-through T-shirt and pink panties while wearing roller skates. Jay becomes excited, but when they try to get into it, they are both clumsy and cannot seem to get active for sex. They try going to the kitchen and the couch, but they are unable to feel pleasure. They decide to pop open a bottle of tequila, when Annie finds one of Jay's iPads and gets the idea to make their own porno after having a chat about watching today's porn, inspired to try something new. Jay agrees, and after a couple shots of tequila, the two of them set up the iPad and try out positions from the book, "The Joy of Sex". After 3 hours, the tape is done, and Annie tells Jay to delete the video as they fall asleep.
The next day, the couple hosts a party at their home for Clive's upcoming graduation ceremony. They invite their friends Robby and Tess (Rob Corddry and Ellie Kemper), and their other couple friends, Punit and Kia (Kumail Nanjiani and Artemis Asteriadis), both of whom are not very happy with their married life and their two babies. After the party, Jay is outside cleaning up when he gets a text from an unlisted number that says "Enjoyed your video. Thanks for sharing. Xoxo." Jay tells the person he's got the wrong number, but the person says he's got the right number and he has seen Jay's sex tape. He panics and runs to his Apple products (iPad, MacBook, Mac computer) to find that the sex tape synced to everything, including the iPads he gave out to his friends. Annie overhears the tape being played, forcing Jay to come clean about not deleting it. They realize they gave iPads to Robby and Tess, Linda, Hank, and even the mailman. They begin to grab any iPad they gave away, starting with Clive's. They grab the boy's iPad out of his hands and throw it out the window. Annie calls her mother to come watch the kids and to bring her iPad. When Linda gets there, Jay takes the iPad and deletes the video from her tablet, and he and Annie run out to stop others from seeing the tape.
The couple drives over to Robby and Tess's home, as Annie suspects the "xoxo" is something Tess would do as a joke. When they get to their friends' house, they see that Robby and Tess are celebrating their 12th anniversary by watching the first season of "Breaking Bad." Jay asks to see their iPad, and Robby jokingly asks if they made a sex tape. Jay blurts out "Did you guys watch it?" He and Annie then go inside and are forced to explain everything to Robby and Tess. They agree to help Annie and Jay find the next iPad, which is in Hank's possession. Tess gets his address from her sister since she is Hank's florist. Before they leave, Jay asks Robby for the iPad, and he begrudgingly hands it over to him.
They get to Hank's fancy home, with Annie and Jay pretending to be collecting money for charity. Annie goes to talk with Hank while having Jay excuse himself to the bathroom by pretending he has food poisoning. In Hank's home, we see multiple ridiculous paintings of himself as characters from Disney movies (like Rafiki, Peter Pan, Geppetto, and a dwarf), and he plays some music for Annie. As Jay goes through Hank's rooms, Hank's German shepherd attacks Jay. Despite whacking it over the head with a book and causing it to run onto a moving treadmill that throws it against a wall hard, the dog continues going after Jay. Meanwhile, Hank invites Annie to do cocaine. She reluctantly agrees to it so that Hank doesn't find Jay sneaking through his place. Robby and Tess then ring the door posing as a mayor and wife from another town that are collecting used iPads. Hank gives them the one that Annie gave him, just as Jay falls out the window with the dog, and he is chased to the front door, bloodied and limping. Hank calms the dog down by saying "Hakuna Matata."
With that situation resolved, Annie and Jay walk back to the car, arguing about this mess. Jay admits that he decided not to delete the tape because he was happy with it and what it added to their love life, while Annie has just been frustrated with all that has been keeping them from having sex. They make up and go back to the car to find Robby and Tess getting it on in the backseat after having viewed Annie and Jay's tape.
The friends drive back to Robby and Tess's house so Robby can give Jay a new shirt. The couple's obnoxiously precocious son Howard (Harrison Holzer) comes downstairs when Jay is alone to reveal to him that HE is the one that sent him the texts. Howard blackmails Jay for $25,000 so that he can take the tape off YouPorn. The boy mocks Jay for not having realized that he could have remote-wiped the tape to get it out of everyone's iPads easily instead of having gone through all the trouble.
When Jay gets home, he calls Robby back to tell him about Howard's scheme, but Robby trusts his son too much to believe what Jay has said. Jay then goes to remote-wipe the tape, but then tells Annie about what Howard told him. Instead of giving in to his demands, Annie gets the address of YouPorn headquarters from their website. They grab Clive and Nell since they can't call Linda back at that time.
They drive to the YouPorn building, which is closed. Jay drives the car into the door to break in. They find the control room and Jay whacks one of the servers with a bat, triggering the alarm. Before they can get out of there, the YouPorn manager (Jack Black) comes in with his wife, two bodyguards, and two attack dogs. He mistakenly believes Annie and Jay are from rival porn sites, but then deduces that they made a sex tape and are trying to get it down, which happens to be a common occurrence. After Annie and Jay introduce themselves, the manager's wife recognizes their names from Annie's blog, which she is a fan of. After talking everything over, the manager agrees to take down the video, but Annie and Jay still have to pay for the damages.
The morning comes, and the family rushes back home to get the kids ready for Clive's graduation. They get to the school and sit in the auditorium. There, Annie and Jay tell each other what they love about one another and are glad that they are still together. The ceremony commences, and Clive is up to present a video he put together from the computer. Jay panics, thinking he forgot to delete the tape from his computer. Clive's video plays, which is actually his grad video, but Jay jumps off the balcony and lands on the table. Robby and Tess help him up and take him to the hospital.
The family is spending time together at home, with Jay now wearing a cast on his leg and a sling around his arm. They get a call from Howard, inviting Clive to have ice cream with him and Howard's babysitter. Jay tells Clive to decline because they are having family time. The doorbell rings, and Howard asks Jay to come outside. Jay thinks Howard is going to blackmail him more, but the boy pulls out a jump-drive that contains the last remaining copy of the tape, since Howard decided to delete any other copy he had. He only wants Jay to let Clive hang out with him because he is the only friend Howard has. Jay agrees and takes the jump-drive from Howard.
Jay is preparing the smash the drive with a hammer, but Annie says they should watch it just once. They load it to their computer and watch the tape, horrified and embarrassed to see themselves acting out awkward sex positions, such as Annie doing a front flip onto Jay's penis, and various other weird acts. The two of them then smash the drive with the hammer, burn it on their grill, shred it in their blender, and then finally bury the evidence for good.