In the film
Riley makes a dream on her first night after moving to San Francisco. The dream starts with the family car landing at San Francisco, where it suddenly turns into a nightmare as all the negative events of the day are recalled. Riley's new house appears as a haunted house, then a mouse pops up on screen and dies instantly, followed by an anthropomorphic bear who delivers pieces of broccoli pizza. Joy, who is on dream duty, dislikes this so much that she cuts the projector off, even though doing so is against the rules.
Later in the film Joy, Sadness and Bing Bong are aboard the Train of Thought heading the Headquarters when the train stops because of Riley falling asleep. Joy figures out a plan to wake Riley up, by giving her an exciting dream. Although Sadness knows it wouldn't work, they set out to Dream Productions, where Joy meets Rainbow Unicorn. The trio enters a film set and hide away.
Meanwhile, the studio is shooting a film in which Riley is at school with no pants, and her teeth start to fall out. Joy puts on half of a dog costume, and gives the other half to Sadness. They come into the dream as a cute dog. Bing Bong starts a party in the classroom with balloons and confetti.
He dances around and ends up knockng over the spotlight. At the same moment, the dog costume rips in half, and Joy chases Sadness around, causing the dream to be half a dog chasing the other half. At the same time, Bing Bong starts talking to the camera, for Riley to remember him. As the scene gets scarier, Riley nearly wakes up, but a security guard takes Bing Bong and shoves him into the Subconscious.
Joy and Sadness pretend to be trying to escape, and get shoved in as well. They follow Bing Bong's candy tears and find him trapped in a cage made of balloons. They free him and they find Jangles, the birthday clown, asleep on the floor. They decide to use Jangles to give Riley a scary dream and wake her up. They tell him that there's a birthday party in Dream Productions, and he takes over the dream, causing mayhem and destroying the set, which startles Riley awake.