Summary:
After being stranded on pre-historic Earth after the events in The Restaurant at the End of the Universe, Arthur Dent is met by his old friend Ford Prefect, who drags him into a space-time eddy, represented by an anachronistic sofa. The two end up at Lord's Cricket Ground two days before the Earth's destruction by the Vogons. Shortly after they arrive, a squad of robots land in a spaceship in the middle of the field and attack the a**embled crowd, stealing The Ashes before departing. Another spaceship arrives, the Starship Bistromath, helmed by Slartibartfast, who discovers he is too late and requests Arthur and Ford's help.
As they travel to their next destination, Slartibartfast explains that he is trying to stop the robots from collecting all the components of the Wikkit Gate. Long ago, the peaceful population of the planet of Krikkit, unaware of the rest of the Universe due to a dust cloud that surrounded its solar system, were surprised to find the wreckage of a spacecraft on their planet. Reverse engineering the vessel, they explored past the dust cloud and saw the rest of the Universe, immediately taking a disliking to it and determining it must go. They built a fleet of ships and robots to attack the rest of the Universe in a brutal onslaught known as the Krikkit Wars, but were eventually defeated. Realising that the Krikkit population would not be satisfied alongside the existence of the rest of the Universe, it was decided to envelop the system in a Slo-Time envelope, allowing Krikkit to survive long after the rest of the universe has ended; the Wikkit Gate was the key to the envelope. However, one ship carrying a troop of robots from Krikkit avoided the Slo-Time envelope, and these robots began to retrieve the pieces of the Gate after they were dispersed about space and time.
Slartibartfast, Arthur, and Ford transport to an airborne party that has lasted numerous generations where another Gate component, the Silver Bail, is to be found, but Arthur finds himself separated from the others and ends up at a Cathedral of Hate created by a being called Agrajag. Agrajag reveals that Arthur has k**ed him countless times before, each time reincarnating into a new form that is soon k**ed by Arthur, and now plans to k** Arthur in revenge. However, when he realises that Arthur has yet to cause his d**h at a place called Stavromula Beta, Agrajag discovered he took Arthur out of his relative timeline too soon, and that k**ing him now would cause a paradox but attempts to k** Arthur anyway. In his insanity, Agrajag brings the Cathedral down around them. Arthur manages to escape unharmed, partially due to learning how to fly after falling and missing the ground while catching sight of a piece of luggage he had lost at a Greek airport years before. After collecting the suitcase, Arthur inadvertently comes across the flying party and rejoins his friends. Inside, they find Trillian, but they are too late to stop the robots from stealing the Bail. Arthur, Ford, Trillian, and Slartibartfast return to the Bistromath and try to head off the robots activating the Wikkit Gate.
Meanwhile, the Krikkit robots steal the last piece, the Infinite Improbability Drive core from the spaceship Heart of Gold, capturing Zaphod Beeblebrox and Marvin the Paranoid Android at the same time.
The Bistromath arrives too late at the gate to stop the robots, so its occupants transport to the planet to attempt to negotiate with the Krikkit people. To their surprise, they find that the people seem to lack any desire to continue the war, and are directed to the robot and spaceship facilities in orbit about the planet. With Zaphod and Marvin's help, the group is able to infiltrate the facilities. Trillian deduces that the Krikkiters have been manipulated, reasoning that the people of Krikkit could not simultaneously be smart enough to develop their ultimate weapon—a bomb that could destroy every star in the universe—while also being stupid enough not to realise that this weapon would also destroy them.
The characters discover that the true force behind the war has been the supercomputer Hactar. Previously built to serve a war-faring species, Hactar was tasked to build a supernova-bomb that would link the cores of every sun in the Universe together at the press of a bu*ton and cause the end of the Universe. Hactar purposely created a dud version of the weapon instead, causing his creators to pulverise him into dust, which thus became the dust cloud around Krikkit. However, Hactar was still able to function, though at a much weaker level. Trillian and Arthur speak to Hactar in a virtual space that he creates for them to explain himself. Hactar reveals that he spent eons creating the spaceship that crashed on Krikkit to inspire their xenophobia and incite them to go to war, also influencing their thoughts. However, when the Slo-Time envelope was activated, his control on the population waned. As he struggles to remain functional, Hactar apologises to Trillian and Arthur for his actions before they leave for their ship.
With the war over, the group collects the core of the Heart of Gold and the Ashes, the only two components of the Wikkit Gate not destroyed by the robots, and returns Zaphod and Marvin to the Heart of Gold. Returning only moments after the robots' attack at the Lord's Cricket Grounds, Arthur attempts to return the Ashes, but is suddenly inspired to bowl one shot at a wicket that is being defended using a cricket ball in his bag. However, in mid-throw, Arthur suddenly realises that the ball he had was created and placed in his bag by Hactar and is actually the working version of the cosmic-supernova-bomb, and that the defender of the wicket is one of the Krikkit robots, ready to detonate the bomb once thrown, all this causing him to trip, miss the ground, and allow him to fly. Arthur is able to throw the ball aside and disable the robot in mid-swoop.
In the epilogue the characters are taking Arthur to a 'quiet and idyllic planet' when they come across a half-mad journalist. He tells them that he was at a court case and a witness there was given too much of a truth drug and started to tell all truth, which was driving everybody there mad. They go to the courtroom in the hope of learning the question of Life, the Universe and everything is from him. They discover he is finished and he has forgotten it all. He then attempts to tell Arthur where God's last message to his creation is, though dies seemingly before Arthur is able to memorise the location.
In the end Arthur goes to live on the planet Krikkit where he becomes a more sk**ful flier and learns bird language.