Norton Juster, the celebrated children’s author who has died at 91, stumbled into literature much as his most famous hero, Milo, stumbles into the marvelous world of wordplay and adventure in the classic 1961 volume “The Phantom Tollbooth.” They were bored and entirely unsuspecting of the wonders that awaited them.

A budding architect with a self-confessed tendency to procrastinate, Mr. Juster was living in New York City and working — or not working — on a children’s book about cities. A Ford Foundation grant had given the project a degree of urgency. But it was not the book he wanted to write, and soon enough, he recalled years later, he was “waist-deep in stacks of 3-by-5 note cards, exhausted and dispirited.”

To pass the time, Mr. Juster began scribbling the story of Milo, a boy of about 9 or 10 years with no interest in the tedium of school or “learning to solve useless problems, or subtracting turnips from turnips, or knowing where Ethiopia is or how to spell February,” and who was as bewildered by the grown-up world as grown-ups were by him.

“He’s more like me than I was, actually,” Mr. Juster once told CBS News.

To pass a little more time, Mr. Juster paced the floors, a habit that drew the attention of his neighbor, Jules Feiffer, a cartoonist then in the early years of his long career at the Village Voice. Mr. Juster showed Feiffer his incubating story, and Feiffer, also with no inkling of where their collaboration would lead, began making drawings to accompany it.

The result was “The Phantom Tollbooth,” a story-time staple that has sold nearly 4 million copies. Children have grown up and read the book to their children, and then to their grandchildren. Encountering a boy named Milo, one might reasonably ask his parents whether their bookshelves contain “The Phantom Tollbooth.”

Mr. Juster died Monday at his home in Northampton, Mass. His death was confirmed by Cindy Lashway, a representative of Douglass Funeral Service in Amherst, Mass. The cause was not immediately available.

The adventures of Milo begin when the boy comes home from school and finds a package containing a tollbooth — some assembly required. Milo passes through the tollbooth in his small pretend car and finds himself in the Lands Beyond.

Milo enters the Kingdom of Wisdom and finds two cities, Dictionopolis and Digitopolis. They are ruled respectively by King Azaz the Unabridged and the Mathemagician, brothers feuding over the primacy of words or numbers. Caught in the middle are the princesses Rhyme and Reason, whom Milo sets out to save.

Wordplay abounds, with a wagon that moves when no one speaks — it goes without saying — and a banquet were everyone must eat their words. Mr. Juster threw in the Triple Demons of Compromise — “one tall and thin, one short and fat, and the third exactly like the other two” — just to pester Feiffer in his illustrations.

“This kid had gone into a world where everything was correct but nothing was right,” Mr. Juster once told the London Independent. “That was a feeling I understood.”

Mr. Juster and Feiffer submitted a draft to Jason Epstein, the editorial director of Random House and not, fortuitously, a children’s editor. Mr. Juster often said that if they had contacted a children’s editor, “The Phantom Tollbooth” might never have been published because it bucked all the prevailing trends of the time.

» READ MORE: When 'Phantom Tollbooth' turned 50

“It was kind of unanimous, it was not a children’s book,” Mr. Juster told NPR in 2012. “The vocabulary was too difficult for kids. The situations and the things I talked about were way out of their understanding. The word play and the punning, they would never get. And to top it off, they told me that fantasy was bad for children because it disoriented them.”

But a glowing review in the New Yorker by Emily Maxwell, a children’s book critic and the wife of the magazine’s fiction editor, William Maxwell, sent the book on its way.

Reading “The Phantom Tollbooth,” she wrote, was her “first experience of opening a book with no special anticipation and gradually becoming aware that I am holding in my hands a newborn classic.” She compared it to “Alice in Wonderland,” Lewis Carroll’s story of a Victorian girl who passes through a rabbit hole to enter her own fantastical world.

Mr. Juster said he had not read “Alice in Wonderland” before writing “The Phantom Tollbooth.” His chief influences had been the Marx Brothers, the absurdist screen-comedy team, and his father, an architect who was enamored of wordplay.

“He would be sitting there,” Mr. Juster told NPR, “and he would look at me and very seriously say: Aha. I see you’re coming early since lately. You used to be behind before, but now, you’re first at last. I had no idea what he was talking about, of course.”

Norton Juster was born in Brooklyn on June 2, 1929. He had an older brother, also a future architect, whom Mr. Juster said their parents favored, leaving Norton largely to his own devices. From an early age, his mind wandered in unusual ways; he had a condition known as synesthesia, in which the senses become intertwined, leading him to experience numbers as colors.

He received a bachelor’s degree in architecture from the University of Pennsylvania in 1952, then studied city planning at the University of Liverpool in England before serving in the Navy. He was stationed at the Brooklyn Navy Yard, where he met Feiffer while living off-base.

Feiffer, who went on to be one of the most distinctive and heralded cartoonists of his era, offered the interpretation that Milo represented Mr. Juster as he left military service.

“Milo in the book is entering a world that’s all new to him,” Feiffer told the School Library Journal in 2011. “That is perhaps the perfect metaphor for Norton having gotten out of the Navy, and entering this professional world where his brother is already a successful architect, and he’s following him in it. And Norton doesn’t really feel that any of this is truly the right fit, but he doesn’t know what is the right fit or where to go.”

The right fit or not, Mr. Juster said he considered himself foremost an architect. He was long associated with the Massachusetts firm of Juster Pope Frazier — whose projects included designing the Eric Carle Museum of Picture Book Art in Amherst — and taught for more than two decades at Hampshire College in Amherst.

For adult readers, Mr. Juster wrote “A Woman’s Place: Yesterday’s Women in Rural America” (1996), an exploration of the difficulties of rural life inspired by his own experience living for a period on a Massachusetts farm.

His children’s books included “The Dot and the Line: A Romance in Lower Mathematics” (1963); “Alberic the Wise and Other Journeys” (1965), with illustrations by Domenico Gnoli; “As Silly as Knees, as Busy as Bees: An Astounding Assortment of Similes” (1998), with illustrations by David Small; and “The Hello, Goodbye Window” (2005) with Chris Raschka, who received a Caldecott Medal for his illustrations of the magical window at a little girl’s grandparents’ house. The story was inspired by Mr. Juster’s own granddaughter.

His wife of 54 years, the former Jeanne Ray, died in 2018. A complete list of survivors was not immediately available.

Mr. Juster’s books inspired numerous adaptations, including Chuck Jones’s Oscar-winning short-film version of “The Dot and the Line” (1965). “The Phantom Tollbooth” was adapted for film in 1970 and became a musical with lyrics by Sheldon Harnick and music by Arnold Black, with its premiere at the Kennedy Center in Washington in 2007.

Mr. Juster and Feiffer reunited nearly half a century after “The Phantom Tollbooth” for the children’s book “The Odious Ogre,” published in 2010. Mr. Juster wrote it, he said, because he “loved the idea of doing in a bully.”

“The one thing you have to understand, which I think we don’t, even to this day, is that we constantly underestimate what kids will understand or what they can deal with,” Mr. Juster told NPR in 2012.

“They understand a lot more, and the really fortunate ones carry that special understanding into their adulthood. And if you lose that, I think you lose something very important.”