It’s been more than a decade since we last had the chance to have our imaginations stirred by Woody, Buzz, Jessie and the rest of the “Toy Story” gang. And that passage of time is the emotional cornerstone of the new “Toy Story 3,” a smartly-conceived, beautifully-executed sequel that rounds out a “Toy Story” trilogy.

Early on in “Toy Story 3,” you can tell that things have changed a lot in the world of the toys and their owner, Andy. After a rousing opening sequence that reestablishes our connection to the main characters, we realize that Woody, Buzz and friends have actually been in box in Andy’s room for what appears to be years. Some of the toys from the two previous films (notably Bo Peep) are gone, having been donated or thrown away. The last of the plastic soldiers desert in search of someone who will play with them.

The toys are feeling unloved, deprived of their raison d’etre: Playtime. “Come on, let’s go see how much we’re going for on eBay,” grumbles Hamm the piggie bank at one point.

But the worst is yet to come.

Andy, now 18, is going off to college and the toys (with the exception of Woody, still the most beloved toy) have no place in that world. So Andy packs up Buzz, Jessie, the Potato Heads, Hamm, Rex and the others to store in the attic. Barbie, a doll his younger sister no longer plays with, gets tossed in for good measure.

But instead of being banished to the attic, the toys first have a brush with disaster (getting tossed in the trash) and then are donated to the Sunnyside Day Care center by Andy’s mother.

At first, Sunnyside — preceded over by the folksy Lotso, a Care Bear-esque stuffed animal — looks like toy heaven on Earth, a place where toys are played with (and loved) all day. There’s even a Ken for Barbie, who apparently has never had a mate.

But things are not as they seem, which Woody — who goes in search of his friends after they’re sent off to Sunnyside — realizes before the rest. To go into detail would spoil some of the movie’s twists, so let’s just say that the rest of this “Toy Story” movie turns into a lavishly-imagined prison break that pays mini-homages to such live action films as “The Great Escape,” “Cool Hand Luke” and “The Shawshank Redemption.”

It is intense, emotionally rich and — at key moments — scary to the point that it makes you wonder how “Toys Story 3” got a G rating when the last two Pixar films, “Wall-E” and “Up,” received PGs.

Director Lee Unkrich — who worked on the first “Toy Story” and co-directed “Toy Story 2” — and scriptwriter Michael Arndt (a Pixar outsider who won a best original screenplay Oscar for “Little Miss Sunshine”) have done a good job of combining the classic (and much-loved) characters of “Toy Story” with new toys that quickly establish their own personalities. They also generally manage to inject a darker tone without losing the warmth and humor that made the first two films instant classics.

As always, the voice work is impeccable, whether it’s Tom Hanks reprising Woody and Tim Allen, who gets some of the funniest moments as Buzz, or newcomers Ned Beatty as Lotso, Jodi Benson as a not-so-ditsy Barbie and Michael Keaton as a Ken who really wants to be a boy’s toy and overcompensates.

And, visually, the film is positively stunning, with chase sequences that eclipse anything in the first two pictures.