When my older brother Jerry became ill with Aids in the 1980s, he was working as a psychologist in New York and I was living in a small cottage in Berkeley, California, with the man who is now my husband. I would phone Jerry every evening and fly in once a month to help him clean his apartment and stock up on food, as well as to discuss his treatments with his doctors and HIV researchers. On one occasion, while he was recovering from a parasitic infection that had caused lesions in his brain and given him dementia, he took my hand and said to me: “I’d be orphaned if it weren’t for you.”

Like hundreds of thousands of other brothers and sisters across the world, I kept telling Jerry: “Just hang on, because one day soon there’s going to be a cure.”

However, helping Jerry through a series of incapacitating, life-threatening infections in 1987 and 1988 often made me feel as if I’d been trapped in a merciless, ongoing nightmare. Caring for him also gave me frequent panic attacks. I constantly feared that I, too, might die young – if not of Aids, then of some other disease or misfortune. As a character says in one of my novels, I seemed to be carrying death around with me in my pocket.

Over the previous decade, Jerry had built up his clinical psychology practice, working mainly with disturbed children. During his final year, I assumed much of the responsibility for managing his illness because no one else was in a position to commit themselves to his wellbeing except for our parents, but Jerry refused to see them. The rage he felt towards them for his unhappy childhood – for his difficulties growing up at a time when being gay was considered deviant and shameful – worsened once he began suffering with Aids.

By April 1989, neuropathy had numbed Jerry’s hands, legs and vocal chords, so he couldn’t walk or even lift a cup of water. His death – on 6 May 1989, when he was just 35 – was crushing, especially because I’d become so physically and emotionally depleted. Guilt trailed me everywhere I went – after all, I’d failed to save his life. Jerry had been such an essential part of my childhood – we’d shared the same room until I was eight years old – that I couldn’t imagine a world without him. Nearly 30 years later, I often still can’t.

My brother’s funeral was the worst day of my life. Seeing his old friends from high school only heightened the unfairness of his dying young, since they – and I – would probably get to live out our lives for many decades to come and he wouldn’t. I sometimes think that those of us who have lost a brother or a sister at a young age are part of the same club – and that non-members cannot understand our lingering sense of unfairness and anguish.

Guilt trailed me. I felt as though I had failed to save his life

Earlier this year, a little more than 30 years since the first World Aids Day, researchers from London announced that a bone-marrow transplant had removed all traces of the Aids virus from an anonymous patient. Along with probably everyone else who lived through the devastation caused by the disease in the 1980s and 1990s, I greeted the news with great enthusiasm and hope.

And yet that night, memories of Jerry’s funeral made me feel trapped in a punishing world. It seemed proof that, for those of us who lost close friends and loved ones to the disease, not only has this advance come decades too late for millions of promising young people who never had a chance to realise their potential, but the trauma of loss, far from healing, never completely ends. Indeed, I still consider it a really good day when I don’t have to visit anyone in an intensive care unit or go to a funeral. Those of us who lived through the height of the Aids pandemic will never forget how the terror of catching the virus added a cruel and desperate edge to daily life in London and other big cities in the 1980s. And we’ll always remember that a great many otherwise kind and well-meaning people wouldn’t hug or shake hands with patients like my brother. Or how hospitalised gay men were often cut off from their long-time partners because no one but legally defined family members were permitted to visit them.

Thankfully, we’ve made significant advances in patients’ rights since then, and the UK and most European countries have made enormous progress in establishing equality for the LGBT community.

After my brother’s funeral, I didn’t begin to feel any relief until I returned home to Alex, my husband. Few friends were willing to discuss my continued suffering with me, which was when I learned that many people fear death so deeply they distance themselves from anyone who tries to talk about it. And then, shortly after I returned home, I dreamed that Jerry had come back to life. He was walking across the patio of a stone mansion where I was apparently a guest. With a rush of relief, I thought: Jerry’s returned to life – everything will be OK now! I dashed out of my room to join him, but he didn’t greet me with excitement or affection. His face was mournful. I discovered that although he could talk, and although he recognised me, he was unable to show any emotions other than sadness and disappointment. His sorrowful face was the same one that he had showed me over his final weeks in the hospital – the face of a young man who has been cheated out of life.

The dream returned to me several times over the next weeks and then vanished from my life until 17 years later – when I was caring for my elderly mother in 2006. On that occasion, my dream encounter with Jerry started me thinking about what he would have been like as a middle-aged man, and soon the figure of Lazarus entered my mind. In the Gospel of John, Lazarus is characterised as Jesus’s beloved friend, and Jesus raises him from the dead.

I once slicked down his fringe so he’d look like Spock

Over the next few weeks, I felt compelled to draw pastel pictures of my brother after he had returned from the dead. I would sketch him standing on the patio of the mansion of my dream, with his slender, haunted face. Then one morning, I drew a fragile figure in a tunic – Lazarus – standing next to my brother, questioning him about his experience of death, and I had my first panic attack in more than a decade.

To try to discover what disturbed me so much in the connection between Lazarus and Jerry, I re-read the Bible, which I’d studied at university in the 1970s. I also began reading every book I could find about daily life at the time of Lazarus’s resurrection.

It was during this period of research that I realised what might have been obvious to me but wasn’t: that Lazarus’s story represented my greatest wish, which was to bring my brother back to life. I came to the conclusion that my unconscious mind wanted me to recognise that I would never feel completely at peace with his death – that I’d never be entirely able to “move on”, as everyone seems to recommend so easily these days.

I decided I had to make Lazarus the narrator of my next novel. After that, I achieved a calming sense of purpose for the first time in months. And yet I was too exhausted by caring for my mother to embark on the project.

Then, in early 2014, I finally felt strong enough to take on the project and explore the way losing a sibling or close friend deepens one’s sense of fragility and makes one question the justice of the world. I wrote the first chapter – set in Lazarus’s tomb – fairly quickly, but it took me three years to complete the book. During the writing of it, I had an important revelation: not only would I never get over Jerry’s death but, shocking as this may seem to some, I didn’t want to. Because all those torment-filled months I spent trying to save his life turned me into a more understanding and empathetic person – someone who was far more accepting of the fear of illness and death that we nearly all have. And it made me into a far better writer, too – one committed to the truth, even when it isn’t reassuring or easy to accept. In the case of my novel, that meant being willing to confront my own failure to save my brother and my lack of faith in an afterlife. The trauma of losing Jerry helped make me into the man that I am.

A few months ago, reading my book proofs, long-forgotten memories of my brother resurfaced: going fishing at dawn with our dad, Jerry posing for our mother while she drew his portrait, me helping him slick down his fringe with hair cream so that he could look like Spock on Star Trek. All those crazy things we got up to when we were kids… every time I leaf through the book, I realise those memories live on.

The Gospel According to Lazarus by Richard Zimler is published by Peter Owen at £14.99. To order it for £13.19, go to guardianbookshop.com