BEING DEAD IS NOT COMPULSORY. NOT IF YOU DON’T WANT TO. These are the words of Death, one of Terry Pratchett’s ingenious comic creations in his Discworld novels. Death has a booming, unamused voice (always in capitals, never in quotation marks), and is the permanent straight man in the comic chaos around him. He goes about his morbid business on a horse called Binky, whose hooves throw up sparks on every street cobble. Death is a skeleton, with eyes like two tiny blue stars set deep within the sockets. He wears a black cloak, carries a scythe and, at the end of a day’s work, loves to murder a curry. At the point of contact with his latest client, he usually spends a few moments having a courteous word or two with the recently deceased, until they fade away.

Now Death has gained a most illustrious client, for Pratchett himself has died, aged 66, after suffering from early-onset Alzheimer’s disease. The exchange is no doubt unamused but courteous on one side, amusing but rueful on the other, but of fervent interest to both parties. It’s a conversation that millions of Pratchett fans would ache to overhear. Would Death dare to speak in capitals to Sir Terry Pratchett?

Pratchett was, and will remain, one of the most popular British authors of all time. In the modern age, only the career of JK Rowling, creator of Harry Potter, is comparable. The facts of Pratchett’s success are impressive: the sheer number of books he has sold (some 80m copies worldwide), and the number of reprints, translations, dramatisations on television and stage, audio versions and spin-offs, plus awards and honorary doctorates galore. Then there’s an inestimable amount of Discworld spinoffery: chess pieces, wizardly hats, cloaks and T-shirts, leathern bags, pottery figurines, fantastic artwork, magic clobber of every kind including dribbly candles – all made by and sold to fans. His signings at bookshops were legendary: a queue stretching down the street was de rigueur, and although Pratchett worked quickly at the signatures, he was unfailingly friendly to everyone who turned up. He was open to readers: he answered emails (or some of them, because the volume of incoming messages was spectacular) and he went to Discworld conventions (almost all of them). He was a nice man, unpretentious and with a wry manner.

Pratchett was born in Beaconsfield, Buckinghamshire, son of David and Eileen. He described himself as an omnivorous reader of books from the local library, making up for his lacklustre years at High Wycombe technical high school. He wrote his first story while still at school: The Hades Business, originally published in the school magazine. It became his first professional sale when it was picked up later by the magazine Science Fantasy. He went into local journalism, working on the Bucks Free Press, and later on the Western Daily Press and Bath Chronicle. While working as a journalist, he wrote innumerable short stories for the newspapers under pen names.

Not long after the nuclear meltdown at Three Mile Island in the US in 1979, he worked as a publicity officer for the Central Electricity Generating Board, and was paid to issue public information about the safety of three nuclear power stations. His nuclear masters had presumably assured him that British reactors were not the sort that melted down. He sold his first few books at this time. He left the CEGB to become a full-time writer in 1987, when offered a deal for the next three Discworld books.

Such a multi-book contract for an almost unknown writer indicated that something special was going on. From the outset his career had unusual qualities. Pratchett’s first fantasy book was The Carpet People, written when he was 18; he rewrote it 30 years later, having revised and reversed his ideas about the importance of kings and wars. It was originally published in 1971 by a local publisher, Colin Smythe Ltd, based in Gerrards Cross. Smythe published the next two or three novels, licensing other editions in British paperback and in the US, but as Pratchett’s popularity grew it became clear to everyone that a larger publisher would be better equipped to promote his books. Smythe stepped aside as publisher and became Pratchett’s agent instead. Thereafter, hardbacks appeared from large publishers, beginning with Gollancz.

Most of Pratchett’s books are set on Discworld, a flat, circular planet where the seas perpetually pour over the sides. Curious sailors who noticed that other ships seemed to disappear over the horizon, and went out to explore, discovered that they truly did disappear. The disc is supported, as if in Hindu mythology, by four large elephants, and they are resting on the back of a frost-covered turtle (gender unknown, although naughty people have tried to find out by building a gantry over the edge and climbing down for a quick peek), which swims sedately through space.

At first, Discworld was used as a background for a series of comic sendups of other fantasy cliches but, as Pratchett himself said, if that was all, he would have run out of steam after a couple of books. Discworld constantly evolved, and part of its fascination for readers was the way in which the background became deeper, more complex and in some cases darker, but nonetheless remained a background. Forty Discworld novels appeared. The emphasis was always on the comedy, the foibles and peccadilloes of the characters, a gentle cynicism about the ways of the world, a joy in puns, a love of irritating footnotes, a relish for the bathetic puncturing of the bombastic – and above all an irrepressible and infectious silliness.

In a publishing world where popular success often equates to ill-written or hackneyed work, Pratchett’s novels, although in a racy, readable style, were constantly witty, with many cultural, vernacular and literary references. You never quite knew where the next association was coming from: you would find sideways references to HP Lovecraft, William Shakespeare, Beachcomber, Sellar and Yeatman, Thomas Hughes, Peter Shaffer (a good joke about Salieri), JRR Tolkien, Egyptology, vampirism, dragons.

The name of the Welsh area of Discworld (very Welsh) has a sly reference to Dylan Thomas: Llamedos. People on Discworld often get things a bit muddled: a fad for Australian-style bush hats goes wrong at first, until the pioneer realises he should remove the corks from the bottles. A vampire gets a job as a press photographer, but inconveniently turns to dust when his flashgun goes off.

In The Light Fantastic (1986), a librarian is turned into an orangutan by an errant spell. It suits him: people give him a lot of bananas, and clambering up to retrieve books from high shelves becomes a doddle. The orangutan was so popular with readers that he reappeared in most of the books that followed. That in turn led to Pratchett’s own passionate involvement with the Orangutan Foundation. In 1995 he went to Borneo with a TV crew and made a highly praised film about the endangered animals.

The humour of the novels was likable and liked: most of Pratchett’s books sold on word of mouth, and the many conventions thrown in his honour were happy occasions. He gave his readers memorable hours of talks, interviews and jokes.

Then, at the end of 2007, following what he thought was a mild stroke, Pratchett was diagnosed with posterior cortical atrophy, a form of Alzheimer’s. The onset was early (he was still in his 50s) but also slow. Higher intellectual capacity was not immediately affected. He was able to go on writing, but typing at a keyboard became a problem. He soon learned there was no cure, nor any realistic hope of one within his expected lifetime, and that Alzheimer’s, so widespread, so destructive not only of the sufferers but also their carers, was a Cinderella disease. UK government support for Alzheimer’s research was running at about 3% of the funding for cancer research. Pratchett immediately donated $1m to Alzheimer’s Research UK, subsequently becoming a patron.

His last years were astonishingly active. He continued to write fiction, learning to dictate rather than type, and a last Discworld novel was completed and delivered last summer. In July, he had to cancel a planned appearance at the biennial International Discworld Convention – it was the first time he had ever missed the event.

Three novels in collaboration with Stephen Baxter were also completed in this period, as well as collections of essays and short stories. In 2010 he wrote and introduced the BBC Richard Dimbleby lecture, which was an impassioned plea for the right of assisted suicide. The lecture was read for him by Tony Robinson, whom the author introduced as a “stunt Terry”.

He was appointed OBE in 1998, and knighted in 2009. He remarked that now everyone would know that he was married to a lady, something he had been aware of for many years – he and Lyn Purves were married in 1968. Their daughter, Rhianna, is also a professional writer of many years’ standing. He is survived by both.

• Terence David John Pratchett, novelist, born 28 April 1948; died 12 March 2015