This episode is considered non-canon and the events featured do not relate to the series and therefore may not have actually happened/existed
"Every Man's Dream" is an episode of Season 27. This episode is the season premiere. 
Homer is diagnosed with narcolepsy - but instead of getting his prescription medication - he comes home drunk. He and Marge visit a marriage counselor and have a trial separation, during which Homer begins dating a 20 something pharmacist - something he soon regrets.
Homer sleeps during a meltdown at the nuclear plant, which leads him to be hospitalized. A spinal tap reveals that Homer suffers from narcolepsy and gives him a medical excuse to prevent Homer from doing activities because of his disease, but he starts using his excuse to simply sleep and escape doing anything at all. Marge gets irritated and tells Homer to get his narcolepsy medication at a pharmacy.
At the pharmacy, there were four senior citizens in front of Homer. Realizing that would take a while, he goes to Moe's tavern and comes home smelling like beer. This scandalizes Marge, who plans to take Homer to a family therapy. But, instead of helping them, the counselor tells them to spend a little time apart followed by a divorce. So Homer leaves the house and starts living at the nuclear plant.
Lenny and Carl tell Homer that Marge changed her status to "It's complicated" and her name on the voice mail back to Marge Bouvier (her maiden name). Homer then goes back to Moe's and receives a call, but instead of Marge, it is the Pharmacist calling because of his medications. While getting his meds, the pharmacist (whose name is Candace) takes Homer on a date and dopes him, which leads Homer to make the one drunken mistake he never made: sleep with someone other than Marge.
From then, Candace and Homer start going out on dates and doing activities as a couple, and Candace presents Homer to her father, who is also with a new lover: Marge. Homer tries to convince her that the pharmacist father is not a great man, but he proposes to Marge, which she accepts as soon as her divorce with Homer is done. At this moment, Candace reveals to Homer that she's pregnant, but Homer wakes up back at the therapist's room, meaning all of this was a dream.
His dream convinces Homer to became a better man for a month. He succeeds, even convincing Lisa to eat meat and Maggie to talk (or sing), But Homer wakes up at a bar during a date with Candace. Seeing everything he has lost, Homer runs back to the Simpson house and finds Marge having a dinner with the pharmacist's father, which made him so depressed that he starts crying in the front yard. At this moment, Lisa opens the door saying that nothing could separate them, as they share the same blood, but she enters the house again, because her "new father" invites her to play chess and go pony shopping later.
At this moment, Marge wakes up, revealing that everything was part of her dream, and takes Homer to the Family therapy again, but before she tells them the solution to their marriage, it's revealed that the therapy is actually a tattoo on a girl's back, meaning "Don't get drunk in Brooklyn".