Edgar Wright, Simon Pegg and Nick Frost complete a sort of trilogy of genre-spoofing films with their newest offering, which combines elements of a reunion movie with the sci-fi premise of “Invasion of the Body Snatchers.” “The World’s End” isn’t as wacky as “Shaun of the Dead” or “Hot Fuzz,” but it’s amusing enough to please their many fans and plenty of others besides. And while it still provides a showcase for the trio’s brand of goofy comedy, it’s actually a more mature piece than its predecessors, stressing the need to grow up and stop living in the past—though always in a humorous vein.

The sparkplug of the plot is Gary King (Pegg), an obnoxious, abrasive man-child obsessed with recapturing the best time of his life—his senior year of high school. In particular he wants to complete the final adventure of that time—a legendary journey called “The Golden Mile” with his four chums from pub to pub in their home town, drinking a pint in each of the twelve and ending at the establishment called The World’s End. Back in 1990 they failed to finish the trip, and now Gary wants to do it right.

But over the intervening two decades the five guys have drifted far apart, and so he has to cajole each of the others to join him in his quest. Despite their deep misgivings, Steven (Paddy Considine), Oliver (Martin Freeman), Peter (Eddie Marsan) and Andy (Nick Frost)—all of them fellows who have moved on it their lives—reluctantly agree, though Andy in particular bears a grudge against Gary, once his best pal, that he finds hard to overcome. (The fact that he’s now a teetotaler will also be a stumbling-block.) And when Oliver’s sister Sam (Rosamund Pike) shows up unexpectedly, it sets off an old rivalry between Gary and Steven, who both still have feelings for her.

Still, the tension among the purported revelers is small potatoes compared what they discover in one of the pubs they visit, when an altercation with some young guys leads to the realization that at least some of the townspeople aren’t human beings at all, but some sort of replicants. That leads to lots of fights and chases, a couple of untimely demises, and the revelation that the entire situation is the result of an alien plot.

That brings up the question of what price mankind is willing to pay for its independence, which is a pretty heavy issue for a comedy to take up if it hopes to remain smart and savvy (unlike, say, a miserably stupid Hollywood production like “The Watch,” the recent Ben Stiller abomination that didn’t have a brain in its head and became no more than a gross-out). “The World’s End” doesn’t entirely solve the problem: the picture’s concluding face-off between the boys and the extraterrestrials is one of the movie’s weakest sequences. But even it has some choice moments, and there’s a coda that ends things on an up note, though some darkness remains.

Before that, moreover, the picture is a winningly observed portrait of the stresses and strains of middle age, told from a perspective that recalls the amiable approach of the British comedies of the fifties and sixties—including the Ealing classics—without slavishly copying it. The result probably won’t please the trio’s committed American fans as much as their previous two pictures—or the last section of this one—but oddly enough it will probably appeal to a wider audience than their rowdier, more frantic material.

On the technical side, this is a solid piece of work across the board, with Bill Pope’s crisp widescreen cinematography and Paul Machliss’ sharp editing taking pride of place. Though the effects in the final reels aren’t exactly stupendous, they’re certainly adequate in this context.

This might not be the be-all-and-end-all of comedies, but it’s worth toasting as a worthy finish to three old friends’ trilogy of takeoffs on movie genres.