Marge and Homer are making love in their room while playing a tape of their arguments so the kids will not come in. When a flying article of clothing hits the tape recorder and plays America's "A Horse with No Name", Bart and Lisa decide to come in. Bart ends up traumatized by the sight and is an emotional wreck the following day. While he is coping, Nelson coerces Bart and Milhouse for their lunch money but also invites him and the rest of the class to his upcoming birthday party. Although Bart convinces all his friends not to go to Nelson's birthday party, Marge makes him attend. After the party, Bart becomes Nelson's new best friend and under Nelson's protection no one dares to mess with Bart (a reference to Goodfellas). There is only one drawback to his newfound friend/bodyguard: he can no longer pal around with Milhouse because Nelson has never had a best friend before and is overly protective and jealous. Eventually, Nelson discovers that Bart had been playing with Milhouse, which leads him to no longer consider Bart a friend. He eventually decides to forgive Bart, however Bart tells Nelson that he thinks he is a psycho. Later, during a field trip to some tidepools, Nelson confronts Bart in a cave, telling Bart he is a bad friend. Suddenly, high tide comes and Nelson saves Bart (but only because they were field trip buddies). Later Bart goes home and remembers the good times he had with Nelson while hugging a "Nelson vest" he had received (referencing to Brokeback Mountain). Nelson rides by on a bike and shouts "Haw haw! I touched your heart!"
Meanwhile, Homer finds himself hooked on one of Lisa's fantasy books, choosing to read an Angelica Button book to Lisa (a parody of the Harry Potter series), instead of having sex with Marge (however the first time, Homer is willing to do so, so he rushes on Lisa's tuck in until Homer gets interested in the book). Homer eventually reads ahead and finds that one of the characters, Greystash, is killed while trying to save Angelica (also spoiling the twist to a now angered telephone repair man that happened to be reading another copy of the novel). Upon 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. Afterwards, Lisa reads the real ending and decides that Homer's ending 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, Lenny and Carl look at him.