Marge and Homer are making love in their bedroom while playing a tape of their arguments so the kids will not come in. When one of Marge's slippers hits the boombox and plays America's "A Horse with No Name", Bart and Lisa plan to come in. Bart becomes traumatized by the sight and is an emotional wreck the next day. While he is coping, Nelson coerces Bart and Milhouse for their lunch money but also invites Bart and the rest of the class to his upcoming birthday party. Although Bart convinces all of his friends not to go to Nelson's birthday party—and coincidentally gets Groundskeeper Willie fired when he mistook "Hell, no! We won't show!" for "Hell, no! I won't mow!"—Marge forces him to attend.
After the party, Bart becomes Nelson's new best friend and under Nelson's protection no one dares to mess with Bart. There is a single drawback to his newfound friend/bodyguard; he is unable to hang out with Milhouse because Nelson has never had a best friend before and is overly protective and jealous. Eventually, Nelson discovers that Bart had been having fun with Milhouse, which leads him to no longer consider Bart as a friend. He eventually chooses to forgive Bart, however Bart tells Nelson that he thinks he is a schizophrenic. Afterwards, during a field trip to some tidepools, Nelson confronts Bart in a cave, telling Bart that he is a bad friend.
Suddenly, the high tide comes and Nelson saves Bart (but only because they were field trip buddies). Later, at home, Bart remembers the good times he had with Nelson while hugging a "Nelson vest" he had received (a Brokeback Mountain movie reference). Nelson rides by on his bike and shouts "Haw Haw! I touched your heart!"
Homer finds himself hooked on one of Lisa's fantasy books, choosing to read an "Angelica Button" book to Lisa, as opposed to snuggling with Marge. Homer eventually reads ahead when Lisa has a sleepover at a friend's house and finds that one of the characters, Headmaster Greystash, is killed while trying to save Angelica. Then, hearing that Greystash dying would be the end of Lisa's childhood, Homer is unable to bring himself to read the last chapter to Lisa, and improvises a happy ending, instead involving Greystash defeating the evil wizard, Angelica managing to get out of the trap and they ride in a sports car Greystash had conjured to a castle.
Afterwards, Lisa reads the real finishing and chooses that Homer's conclusion was better. During the credits, Homer is seen at Moe's Tavern, still mourning the loss of the Headmaster ("No man should have to outlive his fictional wizard!") while Moe, Carl and Lenny look at him.