Andy prepares to go to cowboy camp with Woody, but while playing with Woody and Buzz, he accidentally tears Woody’s arm. Andy’s mother puts Woody on a shelf, and Andy leaves without him. After having a nightmare about Andy throwing him away in a trashcan, Woody finds a squeeze toy penguin named Wheezy, who has been shelved for months due to a broken squeaker. Andy’s mother puts Wheezy in a yard sale. Woody rescues him, but is stolen by a greedy toy collector named Al McWhiggin. Buzz, Hamm, Mr. Potato Head, Slinky Dog, and Rex set out on a mission to rescue Woody. At Al’s apartment, Woody learns he is based on the main character of a 1950s TV show called Woody’s Roundup, and along with Jessie, Bullseye, and Stinky Pete the Prospector (the other people in his show), he is set to be sold to a museum in Japan, but Woody intends to return to Andy, earning him Jessie’s ire. Stinky Pete explains the museum is only interested in the collection if it is complete, and without Woody, they will be returned to storage, which triggers Jessie’s claustrophobia.
Al accidentally rips Woody’s arm off completely while planning a photograph of the Roundup gang, so he calls a toy cleaner to come the next morning to try and fix him. That night while Al is sleeping, Woody attempts to retrieve his arm and escape, but his escape is sabotaged when Al’s television turns on, waking up Al in the process, and he angrily blames Jessie when he finds the TV remote in front of her. The next day, the toy cleaner arrives and fixes Woody’s arm. Woody discovers that Jessie once belonged to a girl named Emily, who eventually outgrew her and gave her away. Stinky Pete warns Woody the same fate awaits him when Andy grows up, whereas he would last forever in the museum. Hearing this and believing that Andy would not play with him anymore if he ever ripped his arm again, Woody decides to stay, much to the delight of the others. He later learns that his TV show was canceled on a cliffhanger due to children’s attention shifting towards space toys after the success of Sputnik.
Meanwhile, Buzz and the others reach Al’s Toy Barn, where they are given a tour by a Barbie doll and Buzz is imprisoned in a cardboard box by a Utility Belt Buzz Lightyear action figure with Buzz’s original space ranger persona, believing Buzz is a rogue space ranger. Utility Belt Buzz then joins the other toys, who mistake him for Andy’s Buzz. After discovering Al’s plan, they head for his apartment. Andy’s Buzz escapes and pursues them, but inadvertently frees an Evil Emperor Zurg action figure, who follows Buzz with the intent of destroying him. The toys find Woody and Buzz rejoins them after revealing the mix up with Utility Belt Buzz to the other toys. Buzz tells Woody that they need to return home, but he refuses to go back, unwilling to abandon the Roundup gang and be eventually outgrown or rejected by Andy.
Buzz reminds Woody a toy’s true purpose is to be played with, which he would never experience in a museum. After seeing a boy hug him on TV, Woody realizes Buzz is right, and asks the Roundup gang to come home with him and the other toys. However, Stinky Pete refuses and reveals he was actually responsible for foiling Woody’s earlier escape attempt by turning on the TV, and framed Jessie for it, as he wants to go to the museum having never been sold to children, loved, or played with. Al then returns, puts the gang in a suitcase, and leaves for the airport. Andy’s toys pursue Al, but are caught by Zurg, who battles New Buzz and reveals himself to be his father, until Rex comes in and inadvertently knocks Zurg off the elevator. New Buzz chooses to remain behind with Zurg, while Andy’s toys, accompanied by three toy Aliens, steal a Pizza Planet delivery truck and follow Al to the airport, where they sneak into the baggage handling system and find Al’s suitcase. Stinky Pete rips Woody’s arm with his pickaxe, but Andy’s toys subdue him and place him inside a little girl’s backpack and he goes home with her. They free Bullseye, but Jessie ends up on the plane bound for Japan. Assisted by Buzz and Bullseye, Woody enters the plane and frees Jessie, allowing them to escape before it takes off. The toys then use a baggage carrier to return home. Andy returns from camp and accepts Jessie, Bullseye, and the Aliens as his new toys, then repairs Woody’s arm, while Wheezy’s squeaker has been fixed as well. Meanwhile, Al is upset in a new commercial after losing the Roundup gang. Woody tells Buzz he is no longer worried about Andy outgrowing him because they will still have each other for company.