Andy Davis (voice: John Morris) is 17 years old, and is heading off to college in a few days. The fact that Andy has grown from a young boy to a teenager about to leave home has not been lost on his toys.
Several of them hold out hope that Andy will play with them at least once before he leaves, but those hopes are soon dashed. As the toys take stock of how many are left, and those that they have lost over the years, their attention is drawn to the last of the little green Army Men: Sarge (voice: R. Lee Ermey) and two paratroopers. Fearful of being thrown away, they leap out the window into the world beyond, their parachutes taking them who knows where.
This idea soon fills the heads of the remaining toys: Woody (voice: Tom Hanks), Buzz Lightyear (voice: Tim Allen), Jessie (voice: Joan Cusack), Bullseye (voice: Frank Welker), Mr. Potato Head (voice: Don Rickles), Mrs. Potato Head (voice: Estelle Harris), three alien squeak toys from Pizza Planet, Slinky Dog (voice: Blake Clark), Rex (voice: Wallace Shawn), and Hamm the Piggy Bank (voice: John Ratzenberger).
Several are of the persuasion that Sarge is right, and they'll be tossed out soon, but Woody believes that Andy wouldn't do that. He figures Andy will store them in the attic...maybe one day to be played with again when Andy has kids of his own.
The toys' "staff meeting" is cut short when Andy returns to his room with his mom (voice: Laurie Metcalf) in tow. With only a few days left until he leaves, Andy has not cleaned up his room. Andy's mom is having Andy's sister Molly (voice: Bea Miller) clean her room as well, and tells the two to throw out what they don't want, store extra items in the attic, or donate items to Sunnyside Daycare. From Andy's room, the toys watch as Molly throws her Barbie doll (voice: Jodi Benson) in the donations box, along with some other toys.
Andy finally takes out a black trash bag and begins to put his old toys into it. When he gets to Woody and Buzz, he hesitates before putting Woody in a box marked 'College' and tossing Buzz in the black trash bag. Inside, the toys think they are going to be thrown away, and Woody watches as Andy leaves the room. His panic turns to relief as he sees Andy open the attic door. However, before Andy can go up, he helps Molly move the donations box downstairs. The lapse causes the attic door to close, and Andy's Mom soon after finds the trash bag with the toys. Thinking Andy left trash lying around, she takes it with another bag to the curb.
Woody looks down the street in horror as the garbage truck slowly makes its way to the curb. Woody jumps out the window and slides down a pipe to the front lawn...only to see the trash bags thrown into the garbage truck and crushed! Shortly thereafter, Woody notices a recycling bin walking towards the garage. Following it, he is relieved to see that his friends escaped. However, they are now all convinced that Andy meant to throw them away.
Woody tries to explain what really happened, but most of them just feel that he is in denial. Jessie soon notices the box of donations to Sunnyside Daycare, and proposes that they all go there. Everyone eagerly jumps in, except for Woody, who demands that they all return to Andy's room right away. Before he can say anymore, the trunk to the family mini-van closes, and Andy's mom takes the box to Sunnyside.
At Sunnyside, Andy's mom brings the toys in to the Butterfly Room. Looking through the handle-hole in the box, the toys are excited to see a group of children happily playing with the toys in the room.
After the recess bell sounds and the kids leave the room, the toys eagerly escape from the box, only to meet a very friendly group of toys who are excited to see them. The group is soon joined by a strawberry-scented bear named Lotso (voice: Ned Beatty), who soon calls his associate Ken (voice: Michael Keaton) to escort the group around, showing them what Sunnyside has to offer. During the tour Ken becomes smitten with Barbie...who finds herself drawn to him as well.
Lotso explains that the toys are taken care of, and that due to a never-ending supply of kids coming and going, the toys will never be without someone to play with them. Andy's toys eagerly accompany Lotso over to the Caterpillar Room, where he then leaves them to experience their first playtime at Sunnyside. However, Ken and Barbie appear to have gotten along quite well, and Barbie eagerly goes back with Ken and Lotso to the Butterfly Room.
Woody explains that while Sunnyside does seem great, he strongly believes they should go back to Andy. Woody asks Buzz to come back, but Buzz refuses, saying they should stick together. Realizing that the others won't accompany him, Woody sneaks out of Sunnyside, but not before accidentally losing his hat. In the process, a little girl named Bonnie (voice: Emily Hahn) finds him and takes him home with her.
Back in the Caterpillar Room, recess ends, and the toys get their first playtime...only to find the room filled with noisy screaming toddlers, each of them rambunctious and not as 'delicate' as Andy was. They are thrown around, smashed about and covered with poster paint by the toddlers. Once the daycare closes, the toys feel there has been some mistake and that they should be in the Butterfly Room instead. Buzz manages to get out of the room, intending to talk to Lotso. However, once outside, his attention is drawn to Ken and several other toys sneaking inside a vending machine.
Buzz follows them, but is caught by a sleepy-eyed doll named Big Baby. Ken and the others take Buzz to the daycare's library and tie him up. Suddenly, Lotso comes across the other toys, and demands that they let Buzz go. Buzz thanks Lotso for helping him out, and makes his request for himself and the other toys to be transferred. Lotso admires Buzz's initiative, but is only willing to consider to have him join the Butterfly Room inhabitants. When Buzz refuses, Lotso orders Buzz held down and procures a Buzz Lightyear instruction manual from the library. Using it, the group of toys sets Buzz to "demo" mode — he's once again the deluded space ranger we met early in the first movie.
Lotso, his compatriots, and demo-Buzz return to the Caterpillar Room, where Buzz subdues his friends and places them in prison-like storage cages. Lotso explains how the daycare is run: all newcomers start in the Caterpillar Room with the ill-behaved toddlers. If they survive, they move up to the Butterfly Room where they'll be treated better.
To set an example about what happens to troublemakers, Lotso has Big Baby take Mr. Potato Head out to the playground and stuff him in "the Box" (a sandbox). Also as a warning, Lotso produces Woody's hat, although he doesn't explain what happened to the toys' friend. Barbie realizes that Ken lied to her and as she refuses to be part of Lotso's regime, she's imprisoned as well.
During the toys' day at Sunnyside, Woody has been in Bonnie's house, taking part in her imaginative fun and games. Woody grows excited to be part of a real playtime again, but longs to get back to Andy.
Once the household is asleep, Bonnie's toys help Woody access the family computer. Woody is relieved to find that Andy's house is just around the corner. He thanks the toys and tells them that if Bonnie ever outgrows them, they should go to Sunnyside. However, the name causes the toys to look on in fear. The toys explain that Lotso is responsible, and one of Bonnie's toys named Chuckles (voice: Bud Luckey) begins to tell a story.
Lotso, Chuckles, and Big Baby were once owned by a little girl named Daisy. Of the three, she loved Lotso the most. However, one day at a rest stop, the three toys were accidentally left behind. The three eventually made it back to Daisy's house. Lotso and Chuckles managed to look in her window, only to see that Lotso had been replaced. Lotso, resentful of being left behind, declared they had all been replaced (even though there was only proof that he had been replaced). Big Baby still wanted to go back, but Lotso yelled "She doesn't love you no more," and tore off a necklace around Baby's neck: a plastic heart that said "I belong to Daisy." Secretly, Chuckles kept it.
The three toys went from place to place until they found Sunnyside. Lotso took over and set up the system in which most new toys would be subjected to the rough handling of the toddlers in the Caterpillar Room and would not survive. Chuckles explains that he eventually was broken at Sunnyside, and Bonnie took him in and repaired him. Realizing the danger his friends are in, Woody decides to return to Sunnyside and rescue them.
The next day, Woody sneaks into the daycare and moves around the building above the ceiling tiles. Finding his way into a hidden area of the Caterpillar Room, he chances upon a Fisher-Price Chatter Telephone (voice: Teddy Newton). The telephone tells Woody that he should have stayed gone, and that there's no way that he and his friends can get out. Woody thanks him for the concern, but says they have to try. The Chatter Telephone explains what Woody and his friends will be up against: Lotso's minions manning search lights on the playground, trucks patrolling the halls and the playground, an 8-foot-high cinderblock wall, and a cymbal-clanging monkey (voice: Frank Welker again) that monitors the security cameras in the building. The telephone says the only other way out is through a garbage chute across the playground.
Once the toddlers have gone to recess, Woody joins his friends, who tell him that Buzz was reset to demo mode, and now they want to get back to Andy. Woody sets his plan in motion. Later that evening, the group springs into action: Mr. Potato Head creates a scene to get put in the box again, this time as a way to get outside and report for the group. Barbie pleads with Ken that she can't take being imprisoned, and Ken lets her out. He takes her back to his dream house, where Barbie subdues him, and using one of his outfits as a disguise, infiltrates the daycare library to find the instruction manual for Buzz. Woody and Slinky Dog infiltrate the main security room and take down the cymbal-clanging monkey. Rex and Hamm start a fight to distract Buzz, allowing Jessie to escape. Then they trap Buzz under a plastic tub.
The toys regroup and set about trying to get Buzz back to normal. However, a mistake in resetting Buzz sets him to Spanish mode. With little time left, the group decides to worry about fixing him later, and they set out for the garbage chute.
The gang gets to the end of the chute before plummeting into the dumpster...only to find Lotso, Ken, and his associates waiting (along with the chatter telephone, now broken by the bad toys). Lotso offers the toys a choice: either end up in the dumpster, or return to the daycare. Jessie and Barbie both decry what Lotso has done to the daycare, and even Ken soon turns against Lotso.
The eagerness of the group and Woody to return to Andy incites Lotso to declare that love doesn't exist. It is then that Woody mentions Daisy and produces the tag that Chuckles kept. Big Baby sees the tag, and Lotso declares that she didn't love them and replaced them. Woody reminds Lotso that it was only him she replaced. This revelation causes Big Baby to reach for the tag before Lotso destroys it, yelling at Big Baby for being stupid and believing that Daisy loved him. Big Baby, feeling betrayed, then throws Lotso in the dumpster.
The other toys begin to run across the lid, but one of the Pizza Planet aliens' feet gets stuck in the lid. Woody goes to help him, only to have Lotso grab his hand. The others rush to help Woody, but just then, a dump truck pulls up and empties the contents of the dumpster (including Andy's toys) into the collecting bin in the back. Barbie and Ken, who were not on the dumpster's lid, can only watch as their friends are taken from them.
Inside the dumpster, more trash is emptied onto the group, and a TV set falls on Buzz — which sets him back to his proper self. However, before the toys can rejoice, the truck arrives at the Tri-County landfill. They're shocked when a bulldozer scoops up the three Pizza Planet aliens, carrying them away! The remaining toys are shoveled by another machine onto a moving conveyor belt, headed towards a large shredding machine. The toys avoid being shredded by grabbing metal objects that are being magnetized to an overhead track. Woody and Buzz even manage to save Lotso, who thanks them.
Once they make it through, they find themselves on another conveyor belt, heading towards what looks like daylight. However, as they draw closer, they soon realize it's a large pit that empties into a fiery incinerator. The toys try to outrun their fiery fate until Lotso notices an emergency stop switch. He motions for the others to help him, and they hoist him up to stop the machine. However, once he reaches the button, Lotso just smirks at Woody, muttering "Where's your kid now, Sheriff?" and runs off.
The toys are soon unable to keep running, and tumble into the pit. They try to climb out, but there appears to be no escape. With no hope left, the toys all join hands, willing to stay together to the very end.
Suddenly, a blue light appears overhead, and a giant claw falls down, scooping up the group. As they wonder who rescued them, the enormous claw swings by the glass cabin of the machine, where the three Pizza Planet aliens are. Once the group gets out, they thank their saviors and wonder what became of Lotso.
Unknown to them, Lotso is found by another garbageman at the dump. Remembering that he had a Lots-a-Huggin' Bear as a kid, he ties Lotso to the grille of his dump truck and he heads off for duty.
Andy's toys find the dump truck that services Andy's neighborhood and manage to get back before Andy leaves for college. After cleaning themselves up, they sneak back into the house, finding Andy's room cleaned out, except for some minimal items, and two boxes: one marked 'College,' the other 'Attic.'
Woody's friends pile into the 'Attic' box, and say their goodbyes. Hearing Andy and his mom approaching, Woody hops in the 'College' box. As they enter Andy's room, his mother is hit with the sad reality that her son is going away. Andy tells her that even though he'll be gone, he'll still care about her.
Hearing this, Woody realizes that Andy can still care for him and the other toys: an example of true love, in that you never forget those you really love. While Andy is distracted by his sister Molly and his dog Buster, Woody grabs a Post-It note and a marker and writes down Bonnie's street address. He takes the Post-It with him and hops into the 'Attic' box.
Andy returns to the room and sees the note on the 'Attic' box. Thinking that his mom wrote it, Andy takes the box to the address and sees Bonnie playing in her family's front yard with the same quirky imagination that he had.
Andy gets out of the car with his box. As Bonnie sees him approach, she stops her game and calls for her mom. Bonnie's mom (voice: Lori Alan) recognizes Andy, who explains that he has some toys for Bonnie. Andy introduces each of his toys, telling Bonnie a little bit about each of them, since he still remembers how he played with them: for example, Hamm saves your money but is also the evil Dr. Porkchop.
With each toy revealed, Bonnie gets more and more brave, until after Buzz, she peeks into the box and sees Woody. Andy has no knowledge of how Woody got in there, but is surprised when Bonnie calls him "my cowboy doll," and quotes one of Woody's lines: "There's a snake in my boot!"
Andy sees Bonnie looking at Woody, and explains to her how important Woody is to him: how long he's had him, and how brave Woody can be. However, he explains to Bonnie that she can have Woody, if she promises to take good care of him, and the other toys. When she quietly nods an affirmative, Andy begins to play with her, and the two are having an imaginative time with their toys. Secretly, Andy's toys are overjoyed at their last playtime with him.
Finally, Andy gets into his car, as Bonnie gathers her old and new toys on the porch. As she holds Woody and Buzz in her little arms, she makes Woody wave goodbye. This causes Andy to give a sad but calming smile. "Thanks, guys," he whispers, as he drives off.
After Andy leaves, Bonnie's mom takes her inside for lunch, leaving the toys on the porch, watching Andy's car fade into the distance down the street. "So long, partner," says Woody. Woody smiles at the other toys, reaffirming that Andy did care for them, and care for them enough to leave them with another child who will take care of them and give them many playtimes to come. Woody introduces his friends to Bonnie's other toys.
Some time afterward, the toys find a note in Bonnie's backpack from Ken. In the time since Lotso has been gone, Ken and Barbie have worked to abolish the unfair system that ran Sunnyside, and now the toys have an equal opportunity to move between the Caterpillar and Butterfly rooms. The toys at Sunnyside now enjoy their time there, and soon after, Sarge and his two paratroopers arrive, with both Ken and Barbie welcoming them.