The writer, who is 85 and grew up in Armley, west Leeds, contributed a diary column to the London Review of Books which was published online today.
He described how his health issues "came as a complete surprise" and also praised NHS workers who had been monitoring his health in the run-up.
In the piece, he wrote: "A big hole in this year’s diary when in April I was found to need an open heart operation: leaking aorta, aneurysm and blocked artery.
"With no symptoms to speak of, it came as a complete surprise and knocked me out for three months, with the diary unreadable (and illegible). Blame the anaesthetic."
-> The Big Interview: Alan BennettFor an August entry, he added: "Me: I’ve not been well. I’ve had a heart bypass.
"Them: Well, you’re a writer, that’s just what you need."
As part of his January entry, he wrote: "My six-monthly aorta scan at University College Hospital. Due at 12.30 I’m early, so that by 12.45 I’m back home.
"It’s a model service, today’s radiographer a bearded young man who asks about [Bennett's 2018 play] Allelujah!, and shows me the screen and how he measures the width of my (quite small) aneurysms.
"Good young medics always cheer me and offer hope, not for my future but for the world in general."
-> School programme reveals a teenage Alan Bennett's first public speaking 'engagement'Bennett told in 2009 how he had needed on an aneurysm in his abdomen the year before.
The diary also includes anecdotes from his life in the Yorkshire Dales, where he owns a cottage in Clapham.
Bennett is one of the country's best-known living playwrights, with works such as The History Boys, The Lady in the Van and The Madness of George III bringing him fame.