A few years after the events in Toy Story, Woody prepares to go to camp with Andy, but his right arm is accidentally ripped. Andy decides to leave him behind, and his mother puts him on a shelf. The next day, Woody discovers penguin toy Wheezy has been shelved for months due to a broken squeaker. When Andy's mother puts Wheezy in a yard sale, Woody rescues him, but is stolen by a toy collector. Buzz Lightyear and the other toys recognize the thief from a commercial as Al McWhiggin, the greedy owner of a toy shop called Al's Toy Barn. Buzz, Hamm, Mr. Potato Head, Slinky Dog, and Rex set out to rescue Woody.
In Al's apartment, Woody learns that he is a valuable collectable based on a 1950s TV show called Woody's Roundup and is set to be sold to a toy museum in Tokyo. The other toys from the show—Jessie, Woody's horse Bullseye, and Stinky Pete—are excited to go, but Woody wants to return home because he is still Andy's toy. Jessie is upset because the museum is only interested in the collection if Woody is in it. Without him, they will be returned to storage. When Woody's arm falls off, his attempt to retrieve it and escape is foiled when the TV suddenly turns on. The next morning, Woody's arm is fixed, and he learns that Jessie was once the beloved toy of a child named Emily who eventually outgrew her and gave her away. Stinky Pete warns him that the same fate awaits him when Andy grows up, whereas he will last forever in the museum. This convinces Woody to stay, and he now believes that all toys eventually get discarded by their owners.
Meanwhile, Buzz and the other toys reach Al's Toy Barn. While searching the store for Woody, Buzz is imprisoned by another Buzz Lightyear action figure with a belt, who believes that he is a real space ranger. The new Buzz joins the other toys, who mistake him as their Buzz and, after discovering Al's plan, they make their way to his apartment. The real Buzz escapes and pursues them. After climbing an elevator, the toys find Woody, and the real Buzz rejoins them and proves that he is Andy's Buzz, but Woody refuses to return home. Buzz reminds Woody of "a toy's true purpose" and warns him that in the museum, he will never be played with by a child again. After seeing a boy play on the TV, Woody changes his mind and asks the Roundup toys to come with him. However, Stinky Pete prevents their escape because he wants to go to Japan, and he prevents Woody from leaving.
Al arrives and takes the Roundup toys with him, forcing Andy's toys to follow him while the new Buzz chooses to remain behind. Accompanied by three toy Aliens, they steal a truck and follow Al to an airport, where they enter the baggage handling system and free Woody. Stinky Pete rips Woody's right arm again and tries to mutilate him, but is stuffed into a little girl's Barbie backpack by Andy's toys. They free Bullseye, but Jessie ends up on the plane bound for Japan. Assisted by Buzz and Bullseye, Woody boards the plane and frees Jessie, allowing the toys to go home.
Andy returns home from the camp, accepts Jessie, Bullseye, and the Aliens as his new toys, thinking his mother bought them, and repairs Woody's torn arm. The toys learn from a commercial that Al's business has suffered due to being unable to sell the Roundup toys. Woody tells Buzz that he is not worried about Andy discarding him because, when he does, they will always have each other for company. Meanwhile, Wheezy has been fixed and ends the film with a Sinatra-style version of "You've Got a Friend in Me".