The mechanical beings are members of an extra-terrestrial race that gave Earth all its technology, hoping to ultimately make Earth a paradise and welcome them into the inter-galactic community. After the remaining survivors of the drinking group - Gary, Andy and Steven - reject the robot's offer for world peace, the robots leave earth and destroy all of Earth's technology as they depart. Though the world is now once again primitive, most people (including the three friends) seem far happier to be free (and Gary has since become sober).
The film begins with retro video narrated by Gary King (Simon Pegg) who is reminiscing about his high school days in a British town called Newton Haven. He recounts how he and his four best friends attempted to complete the town's "golden mile" challenge, where you drink a pint at each of Newton Haven's 12 pubs, the last one being a bar called "The World's End." The friends ended up failing the challenge just three pubs short .
Gary (who is clearly still obsessed with his high school years) decides to track down his former friends and get them to attempt the Golden Mile once again. They include business-obsessed real estate agent Oliver Chamberlain (Martin Freeman), weak-willed geek Peter Page (Eddie Marsan) and recently divorced Steven Prince (Paddy Considine). They agree to come only if their fifth friend and Gary's former best friend Andy Knightley (Nick Frost) also agrees. Gary convinces Andy (who is now devoted to sobriety) to accompany them by repaying an old debt (with money he borrowed from Oliver, Peter and Steven) and also telling Andy that his mother is dead (later revealed to be a lie).
Gary still drives the same car and wears the same clothes he had in high school. While in Newton Haven, the group are briefly joined by Oliver's sister Sam Chamberlain (Rosamund Pike). She has returned to see her old friends and is still bitter at Gary for using her for sex the last time they all tried the Golden Mile. Steven is also upset that Gary had a fling with Sam as he has always loved her.
All but Gary seem to notice that the town has changed significantly since they were last there and that the townspeople are acting oddly. Eventually, Andy tires of Gary's juvenile actions and threatens to leave. Before Andy can leave, however, the group is engaged in a bar fight where it is revealed that the many of the townspeople have been replaced by robotic replicants. Realizing that the robots may pursue them if they suddenly leave, the group continues to journey along the Golden Mile. They also find Sam and rescue her from other robots. Andy also begins drinking again due to the stress of the situation.
Along the way, they have encounters with some humans remaining in the town, former drug dealer Reverend Green (Michael Smiley) and grumpy barfly Basil (David Bradley). The robots become more belligerent at each bar until the group meets the robotic replicant of their former school counsellor, Guy Shephard (Pierce Brosnan). Guy tells them that that the robots (they hate the term "robot," as it is derived from a term meaning "slave") are actually an extraterrestrial race that seeks to bring peace to Earth. It is also unveiled that Oliver has already been replaced by a replicant during their pub crawl. The group refuses Guy's offer to join them, resulting in a car chase. Gary helps Sam escape from the town, but the robots capture Peter and seemingly capture Steven as well.
Andy and Gary finally have an opportunity to escape, but Gary refuses to take it, preferring to remain and finish the Golden Mile. Andy and Gary fight, with Andy saying that the reason their friendship ended was that Andy crashed a car while driving Gary to a hospital while he was drunk one night, and that Gary had simply run away from the crash leaving Andy to die. Gary then reveals that he is immature and actually tried to commit suicide as he is unhappy about his lack of success in life and misses his friends. The two reconcile and Andy goes to pour the final pint at the World's End, which they have finally reached. The beer tap actually lowers them into the robotic headquarters. Steven, who somehow escaped the robots, climbs down and joins them as they are confronted by the entire town (of which, there are only three other remaining humans).
It turns out that the robotic beings are part of the "Network" (the leader is voiced by Bill Nighy) and are responsible for creating all of Earth's technology. They have colonized numerous other planets by using the spread of technology to bring peace and understanding to all nations. Although they mulch the humans that they replicate (after implanting most of the human's memories into their robotic bodies), their goal is to replicate as few of the native species as possible. They ask the three friends to join their cause and even offer Gary the chance to have his memories placed in a replication of his teenage body (thus guaranteeing him eternal youth). The Network says once Earth is peaceful, they can also join an intergalactic union of planets who have joined the Network.
Gary, Andy and Steven reject their offer, stating that it is better to be free and live in pain than be peaceful but robotic. They also point out that the Network has done a terrible job as there are so few humans left in the town. Gary also notes that he doesn't feel that the technological advances of the Network has made the world a better place. The Network then agrees to leave the Earth rather than face (and forcibly mechanize) humans like Gary. As the Network leaves, they destroy all of Earth's technology(which they had given to the Earth anyways), although Sam returns to drive the three friends to safety from the blast and the replicants are abandoned but functional.
We jump ahead to find that the world has reverted to a new "Dark Ages," but that everybody is generally far happier. The replicants are slowly integrating with the humans and the replications of Oliver and Peter have returned to their former lives. Andy has returned to his wife and child and is a leader of a thriving farm. Steven and Sam get married. Lastly we see that Gary is still having adventures with the teenage replications of his former friends to once again complete the Golden Mile, but has also decided to live a sober lifestyle, asking only for water (showing that he has matured somewhat)