"How I Wet Your Mother" is the sixteenth episode of Season 23.
In a parody of Christopher Nolan's Inception, following a traumatic incident, Homer's bed-wetting problem worsens, and his family choose to infiltrate his dreams to get to its subconscious source. Also in Homer's dreams is where his late mother Mona Simpson (voiced by Glenn Close) resides.
At the power plant Mr. Smithers forgets to close the office supply room door after a plutonium carbon rod props it open, and Homer squeezes his head in right before Carl closes it. Then, all the employees steal the free supplies, stuff them into their cars, and try to leave before Mr. Burns notices. Homer drives past the gate, which closes on a car, which causes a chain reaction of the cars' trunks opening, up to the back car that Mr. Burns notices. He punishes all the employees but Homer in a meeting, and then all the workers give Homer bad karma.
Bart and Homer go fishing the next day, which Homer received off. The next morning, Homer wets his bed and wonders what happened. He feels bad for his friends, and throws a picnic for them where they forgive him. The next day, he wets his bed again, but it's worse. He plans to go to Shameful Eddie's, a superstore that sells embarrassing supplies. That night, Homer turns on the device that detects when he wets the bed. The alarm goes off and wakes Marge and the kids. They go into the room and notice the machine, and laugh.
The night after, Homer and Marge try to make love after Homer tries adult diapers, which Marge doesn't like. She takes a walk and sees Professor Frink getting shot out of his house. He says that he knows about Homer's bed-wetting problem from Twitter (Bart tweeted it, then Krusty retweeted it), and he offers to help with a device that enters someone's dreams and explore their subconscious. The family agrees to try it.
They first enter Homer's dream, which they are all skiing downhill with Grim Reaper, who has a coffin with the word "marriage" on it. They speed off a cliff and almost die in the dream (Professor Frink forgot to modify the device to make it where the family doesn't die in real life if they die in the dream), before they switch to another dreamworld. They are in a therapists office, appearing as their Tracey Ullman selves, with the coffin there. When they open the coffin, it is full of fish that squeeze them to the ceiling. They enter Lisa's dream, a Renaissance, but then exit because it is boring. They enter Homer's Land of Innermost Thoughts and Utmost Desires, where he sees his friend Keggy.
They walk down the street, filled with large fast food buildings and a giant Kwik-E-Mart. Then, police come to the Simpsons house and try to unhook the dream machine, which destroys Homer's dream.
At the Simpsons's house, Frink and Chief Wiggum fight for the machine. Then, Death arrives at the gears, takes off his mask, and reveals to be Mona Simpson, Homer's mother, who lives on in Homer's dreams. She shows them a memory. In the memory, Mona tells Homer and Grampa to go fishing for dinner. Grampa caught a fish, and they fell in the water and got shipwrecked. Homer feels guilty that he broke up their parents, and Marge figures out his bedwetting problem. Then, his mother reassures him and cures him of his problem.
Over the end credits, David Byrne and Glenn Close sing a version of "Dream Operator" from the David Byrne movie True Stories.