Night Mare centers around Mare Imbrium, one of the night mares charged with delivering bad dreams to the people of Xanth. Imbri carries half a soul, her fee for being the unwilling steed of the half-nymph Tandy. She is unwilling to relinquish her soul, though the conscience that comes with it impedes her ability to deliver bad dreams. The Night Stallion, ruler of the gourd realm, banishes Imbri to the day world and sends her to meet Trent, King of Xanth, with the ominous message, "Beware the Horseman".
Imbri leaves the gourd realm and journeys to the day world, at first flinching from the touch of sunlight but realizing it would not harm her, though it nullified her ability to turn invisible and intangible. She sets out for Castle Roogna, determined to deliver the Stallion's message to King Trent. Along the way she meets an intelligent man with whom she strikes up a conversation. He convinces her to allow him to ride, but when she becomes confused by his verbal commands, she allows him to insert a bit into her mouth. Realizing she dislikes the bit, she asks him to remove it. When he refuses, she orders him off her, and to suborn her will to his, he uses spurs on her, and captures her.
The man, whom Imbri deduces is the Horseman from the Night Stallion's warning, corrals her at his camp and builds a large bonfire to shine light on her and prevent her from turning intangible. As the Horseman and his henchmen sleep, a light-colored horse wearing bands on its feet similar to the Horseman's, approaches and courts her. She tells him of her plight and he affirms that he is terrified of the Horseman. The horse, whom Imbri calls the "day horse", assists her anyway, and urinates on the fire until it goes out, enabling her to escape.
Imbri escapes and makes her way to Castle Roogna. When she arrives, the castle is preparing for the wedding of Prince Dor and King Trent's daughter, Princess Irene. Upon becoming acquainted with Chameleon, the wife of Bink and mother of Prince Dor, she is led to find King Trent, only to discover that he has been ensorcelled, staring blankly into space.
Prince Dor, next in line to the crown and newly wed to Princess Irene, assumes the throne. He informs Imbri and others that the Nextwave Invasion is occurring; an army of barbarians from the neighboring, nonmagical land of Mundania has just entered Xanth. King Dor orders Imbri and Chameleon to seek advice from the Good Magician Humphrey.
Imbri and Chameleon travel to Humphrey's castle and navigate through the standard three challenges, gaining access to the inside. Humphrey's wife, the fearsome Gorgon, leads the pair to the Magician. The old man casually repeats the Night Stallion's warning, "Beware the Horseman" and adds another cryptic instruction: "Break the chain."
Imbri and Chameleon return to Castle Roogna, where they learn Dor has fallen to the same ensorcellement as King Trent, and is now catatonic. Since the law of Xanth requires that a Magician sit on the throne, the Magician Jonathan becomes the new king. Jonathan's magic talent is to reanimate the deceased, and he rallies his zombies to form an army to fight the Punic invasion from Mundania.
Jonathan falls to the same bewitchment as Trent and Dor. Humphrey assumes the throne, and prepares himself for battle against the Punic horde and its leader Hasbinbad. He informs Imbri, much to the chagrin of the Gorgon, that he is not destined to be the savior of Xanth, and that he expects to make a tragic mistake in battle.
Before departing to the battle, Humphrey identified his successor: Dor's father Bink, whom everybody assumed had no magic talent. Humphrey revealed to Queen Iris that Bink's talent was immunity from magical harm, and its nature had been hidden so his enemies would not revert to using nonmagical means to harm him. It was hoped that Bink would be immune from the effects of the Horseman's spell. Imbri was sent north to the border of Mundania, where Bink and the centaur scholar Arnolde were traveling. Imbri brought news to Bink and Arnolde of the invasion, and informed Bink that he was slated to become King of Xanth upon Humphrey's demise. Bink agreed to accompany Imbri back to the castle and instructed Arnolde to follow, for Arnolde would be king after Bink fell.
Bink and Imbri traveled to the baobab tree and find Humphrey, taken by the power of the enemy. He has a bottle in his hand, and when Bink uncorks it, Humphrey's voice emits from it, with one word: "Horseman". Bink surmises that Humphrey's voice was identifying his assailant, and that they now knew who was ensorcelling the kings. Bink and Imbri prepare for battle alone, armed with Humphrey's numerous spells and potions. They set aside a box marked "Pandora". He and Imbri are victorious but are separated in the battle. When Imbri tracks down Bink, she finds that he has killed the Punic leader Hasbinbad, but has been taken with the Horseman's power nonetheless. Imbri returns to Castle Roogna to inform Arnolde the Centaur that he is now King of Xanth.
Arnolde begins laying plans for his successor, and he interprets Xanthian law to his advantage. The law states that the king must be a Magician, and that there can be no ruling queen. Arnolde states that a Sorceress is simply a female Magician, and that the law does not prohibit a woman from becoming king. He selects Queen Iris to be his successor, and he proclaims her daughter Irene to be a full Sorceress, thus establishing who would be the seventh and eights kings after him. Arnolde then instructs Imbri to report to the Night Stallion with an update.
Imbri journeys through the hypnogourd to the Night Stallion's demesnes, and upon arrival is amazed to learn that all five of the bewitched kings are present in the gourd. They surmise that the Horseman's magic talent is to connect a person's line of sight to another object, and that he has used this ability to make them all see into a hypnogourd, trapping their souls inside. Imbri and the others also deduce that the handsome day horse, who has appeared to help Imbri and the others on numerous occasions, is actually the Horseman in an alternate form.
Imbri brings this news to Castle Roogna, and eventually brings Princess Irene to the gourd to visit her new husband Dor, taken from her after their nuptials. Shortly after the pair return to Castle Roogna, Arnolde is taken by the Horseman, and Queen Iris becomes King Iris, the first female king.
Iris uses her talent of illusion to inflict massive casualties on the Punic horde, who are now marching on Castle Roogna under the command of the Horseman. She briefly forms an image of her own face in front of the Horseman to mock him, whereupon he simply uses his talent to entrap her. Princess Irene becomes king of Xanth next, and she identifies Chameleon as the next king, stating that Chamelon's talent of perpetual change is a Magician-level talent.
The Horseman expends nearly the rest of his forces in reaching Castle Roogna. Irene lures the Horseman into the castle, and once he is inside, uses her talent of accelerated plant growth to wrap the castle in a tight cocoon of plants, trapping him inside. Enraged, he uses his magic to ensnare her, whereupon Chameleon becomes king of Xanth and informs him that he will fail. He takes Chameleon with his power, too, and Xanth is left without a king.
Imbri rushes to the gourd where all nine kings are gathered. They inform her that her triple ability; the ability to phase intangible, turn invisible and to project her thoughts into the minds of others, qualify her as having a Magician-level talent, and Chameleon names her the tenth king.
Imbri travels back to Roogna to confront the Horseman. He is now sitting on the throne, having proclaimed himself the new king of Xanth. As Imbri approaches, he shifts into his alternate form, and Imbri is stricken; she is in season, and he is a male horse. She is unable to act under his dominating power, but when the barbarians break into the castle and call out for their leader, he shifts back to his human form to call out to them. Imbri attacks and kills him, but the nine catatonic kings do not revive.
Imbri realizes that the Horseman's magic talent was shape-shifting, and that the bands he wore around his wrists were magical bands that allowed him to perform his ensorcellment. She removes the bands but is unable to damage them. She decides to travel to the Void, an area in the Elemental region of Xanth, from which nothing can escape. She takes the bands there and throws them in, but is trapped by the gravitational pull of the Void. Terrified, her physical body is destroyed by the Void.
The nine kings revive as the magical bands are destroyed, and Imbri returns as a day mare, now charged with bringing pleasant daydreams instead of nightmares to the people of Xanth. The remaining few hundred barbarians are assimilated into the population of Xanth, and King Trent and Queen Iris retire, leaving the throne to their new son-in-law, King Dor.