At the beginning of the story, protagonist Haroun Khalifa lives with his father Rashid, a famous storyteller, and his mother Soraya, until the latter is seduced by their neighbor 'Mr. Sengupta' to leave home. Thereafter Rashid is hired to speak on behalf of local politicians; but fails his initial assignment. The two are thence conveyed to the 'Valley of K' by courier 'Mr. Butt', to speak for 'Snooty Buttoo', another politician. Attempting to sleep aboard Buttoo's yacht, Haroun discovers 'Iff the Water Genie', assigned to detach Rashid's imagination, and demands conversation against this decision with Iff's supervisor, the Walrus. They are then carried to the eponymous 'Sea of Stories' by an artificial intelligence in the form of a hoopoe, nicknamed 'Butt' after the courier. Of the Sea of Stories, Haroun learns it is endangered by antagonist 'Khattam-Shud'.
In the Kingdom of Gup, Prince Bolo, General Kitab, and the Walrus announce their plans for war against the neighbouring kingdom of Chup, to recapture Bolo's betrothed Princess Batcheat. Rashid joins them here, having witnessed Batcheat's kidnapping. Thereafter Haroun and his companions join the Guppee army toward Chup, where they befriend Mudra, Khattam-Shud's former second-in-command.
Haroun, Iff, Butt the Hoopoe, and Mali the stories' gardener, investigating the Sea's 'Old Zone', are captured by Khattam-Shud's animated shadow, who plans to seal the Story Source at the bottom of the Sea. Before he can do so, Mali destroys the machines used by him to poison the Sea, and Haroun restores the Sea's long-annulled alternation of night and day;––– thus destroying the antagonist's shadow and those assisting him, and diverting the giant 'Plug' meant to seal the Source. In Chup, the Guppee army destroy the Chupwalas' army and release Princess Batcheat; whereupon Khattam-Shud himself is crushed beneath a collapsing statue commissioned by himself. Thereafter the Walrus promises Haroun a happy ending of his own story. On return to the human world, Rashid reveals Haroun's adventures to local citizens, who expel Snooty Buttoo.
When Rashid and Haroun return home, the people of their city have become joyous to replace their customary misery, and Soraya has returned to her son and husband. The novel concludes with an appendix explaining the meaning of each major character's name.