During a church service, Bart tricks the congregation by distributing the lyrics to a hymn titled "In the Garden of Eden" by "I. Ron Butterfly", which is actually the psychedelic rock song "In-A-Gadda-Da-Vida" by Iron Butterfly, that the unwitting parishioners and organist proceed to perform for 17 minutes, after which the elderly organist eventually passes out from exhaustion. Reverend Lovejoy demands that the perpetrator step forward, with threats of fire and brimstone, at which Milhouse snitches on Bart. As punishment, Lovejoy assigns them (Milhouse for snitching) to clean the organ pipes. Bart is indignant with Milhouse, who claims he feared damnation of his soul. Bart proclaims that there is no such thing as a soul and for $5 agrees to sell his to Milhouse in the form of a piece of paper saying "Bart Simpson's soul". Lisa warns that Bart will regret selling his soul, but he dismisses her fears. However, Bart soon finds that Santa's Little Helper and Snowball II seem hostile towards him, automatic doors fail to open for him, when he breathes on the freezer doors at the Kwik-E-Mart no condensation forms, and he can no longer laugh at Itchy & Scratchy cartoons. Suspecting he literally lost his soul, he sets out to retrieve it.
Bart attempts to retrieve his soul from Milhouse, who refuses to return it for less than $50. That night, Bart has a nightmare about being the only child in Springfield who does not have a soul. Lisa torments Bart with a dinnertime prayer leading him to make a desperate, all-out attempt to get the piece of paper back. Bart crosses town to where Milhouse and his parents are staying with his grandmother while their house is being fumigated. The visit turns out to be fruitless; Milhouse had traded the paper to Comic Book Guy at the Android's Dungeon. A frustrated Bart runs off into the night. He encounters Ralph Wiggum in his father's police cruiser and attempts to buy his soul. When Ralph refuses he hisses and disappears in a vale of smoke and haze.
The following morning, an annoyed Comic Book Guy tells Bart that he no longer has the piece of paper but refuses to reveal to whom he sold it. Bart walks home in the rain, then in his room he prays to God for his soul. Suddenly, a piece of paper with the words "Bart Simpson's soul" floats down from above. Bart discovers that Lisa had purchased the piece of paper. While she explains philosophers' opinions on the human soul, Bart happily devours the piece of paper. Realizing how uninterested Bart was in about her lecture about the human soul, Lisa tells him that she hoped he learned his lesson from this. At night when Bart goes to bed, he and his soul are having fun with their quirks, proving that Bart did learn his lesson in the consequences of selling his soul.
In the subplot, Moe wants to expand his customer base by turning his tavern into a family restaurant called "Uncle Moe's Family Feedbag", after numerous unhelpful concept ideas from Homer. The restaurant turns out to be a T.G.I. Friday's-style restaurant full of tacky decorations and gimmicks, including one where a special French Fries dish is served with the basket strapped to Moe's head. However, the stress of running a family restaurant by himself ultimately starts to drive him unhinged, especially his ill-conceived policy of voiding the bill for anyone he does not smile for when he gives it to them. Finally, driven over the edge, he yells at a little girl who complained that the soda was too cold. The family patrons are outraged and abandon the restaurant, forcing Moe to revert the restaurant back to a run-down tavern.