Andy is 17 years old and preparing to leave for college. He has not played with his toys for years, and most have gone, except for Woody, Buzz Lightyear, Jessie, Bullseye, Rex, Slinky, Hamm, Mr. and Mrs. Potato Head, the Aliens, and three toy soldiers. The despondent toys reflect on their future, and the soldiers parachute out the window and leave.
Andy intends to take Woody to college and puts the others into a trash bag to put them in the attic; however, Andy's mother mistakes the bag for trash and puts it on the curb. The toys narrowly escape and, believing Andy threw them away, get into a donation box in his mother's car with Molly's old Barbiedoll, bound for Sunnyside Daycare. Woody follows, but is unable to convince them of Andy's real intentions, and goes along when Andy's mother drives to Sunnyside.
At Sunnyside, Andy's toys are welcomed by the other toys, led by Lots-O'-Huggin' Bear ("Lotso"). The toys (except Woody) are delighted to learn that Sunnyside never runs out of children, and Barbie is enamored with a Ken doll.
Woody attempts to return home but is instead found by a child from Sunnyside named Bonnie, who brings him home and plays with him and her other toys. Bonnie's toys are shocked that Woody came from Sunnyside, and Chuckles, a toy clown, explains that he, Lotso, and Big Baby were owned by a girl named Daisy, but were lost during a family trip. When they made it home, Lotso found out that he had been replaced. Embittered, he lied to Big Baby, saying Daisy had replaced all of them. They went to Sunnyside, where Lotso took over, turning it into a toy prison. Chuckles was eventually broken and later found by Bonnie.
After Andy's toys are subjected to a very rough playtime with the toddlers, Buzz asks Lotso to move the toys to the older children's room, but Lotso switches Buzz to his original factory setting, erasing his memory. Mrs. Potato Head, through an eye she lost in Andy's room, sees Andy searching for them. They realize that Woody was telling the truth about Andy's intentions and try to leave but, with the assistance of the now brainwashed Buzz, are imprisoned by Lotso's henchmen.
Woody returns to Sunnyside, where a Chatter Telephone tells him that there is now only one way out – the trash. Andy's toys subdue Buzz, but they accidentally reset him to his Spanish mode. Buzz allies himself with Woody and falls in love with Jessie. The toys reach a dumpster but are cornered by Lotso's gang. Woody reveals Lotso's deception to Big Baby, who throws Lotso into the dumpster. As a garbage truck approaches, the toys try to leave, but Lotso pulls Woody into the dumpster. The rest of Andy's toys jump after him, just as the truck arrives, and all fall inside. Buzz returns to normal after a television falls onto him inside the truck.
The truck takes the toys to a landfill, where they are swept onto a conveyor belt that leads to an incinerator. After narrowly avoiding a shredder, Woody and Buzz help Lotso reach an emergency stop button, only for Lotso to abandon them. The toys fall into the incinerator and resign themselves to their apparent fate, but are rescued at the last second by the Aliens operating the claw crane. Lotso is later found by a garbage truck driver who ties him to his truck's radiator grille. Woody and the other toys ride another garbage truck back to Andy's house.