Author Bill Hayes was lying in bed when his partner Steve suddenly died of cardiac arrest right next to him.

Hoping to heal, Hayes moved from San Francisco to New York in the spring of 2009. “The city was so alive at night. There’s a sense of kinship that was good for my soul,” Hayes told The Post. He also found love again in the city, this time with famed neurologist Oliver Sacks, a romance he shares in his new memoir “Insomniac City.”

“It’s utterly simple and old fashioned. Oliver Sacks wrote me a letter,” said Hayes on how the unlikely duo initially met. Sacks had read Hayes’ latest book and wrote to let him know how much he had enjoyed it. Hayes, still on the West Coast, knew Sacks’ work and was flattered, felt intrigued and responded.

Hayes had come out in 1984 and was working as a fundraiser during the height of the AIDS epidemic, where he saw many young men get sick and die. At the same time, Sacks’ clinical career as a doctor had exploded. He was defined by his work with a group of patients who suffered from the “sleeping sickness” encephalitis, which he detailed in his blockbuster book “Awakenings.” (It became a 1990 movie starring Robin Williams as a fictionalized Sacks.)

Both Hayes and Sacks had experienced a lot of suffering, and their friendship slowly became a love affair. Hayes was 48, still healing from the heartbreak of losing his former partner, and Oliver was 75, a deeply private public figure who hadn’t had a long-term romantic relationship in 3¹/₂ decades.

Sacks’ sexuality was often under question as his fame as a neurologist and author of books like “The Man Who Mistook His Wife for a Hat” and “Uncle Tungsten” grew. “He didn’t like to be pinned down in that way,” said Hayes of Sacks, who was born in Britain. “He was many things. He was raised in a very traditional Jewish household where homosexuality was considered an abomination. In England at the time it was illegal.”

“Oliver liked the rituals and traditions of Judaism. He was also an atheist. He was a trained neurologist and medical doctor but also a self-taught botanist and historian of science, medicine and music. He felt all these aspects of himself was part of one’s nature and not necessarily to be teased out,” said Hayes, “Often it’s bigotry, homophobia and racism that forces people to stand up for themselves and defend their own identity.”

In his book, Hayes captures both the frenetic, exhilarating pace of New York City as well as the whimsy, fun and romance of the years he spent with Sacks. “Oliver didn’t own a computer. He never once sent an e-mail or text. His telephone address book consisted of six names.”

Hayes and Sacks lived in a slow-paced world. Sacks would write all day, while Hayes walked the streets taking photographs, some of which would end up appearing in Vanity Fair and The New Yorker. They would come together in the evenings over a bottle of wine to share their work and have a quiet dinner of grilled salmon while listening to classical music on the radio.

Sacks had a mischievous side, enjoying eating marijuana cookies with Hayes and deciphering shapes in the clouds above the city skyline from the roof of their building

They had different apartments in the same West Village building — “a civilized arrangement for gentlemen of our age,” Hayes said, though they mostly lived in Sacks’ place on the eighth floor. “It was a time-capsule environment,” said Hayes. “Oliver used to say music can make its own sense of time. That was true of our life.”

Sacks had a mischievous side, enjoying eating marijuana cookies with Hayes and deciphering shapes in the clouds above the city skyline from the roof of their building.

Yet, Sacks, who was 30 years older than Hayes, also dealt with increasing health problems, and Hayes became his caretaker of a sort.

Sacks had a broken hip, a knee replacement, poor eyesight and poor hearing, and in January 2015, got his terminal cancer diagnosis, which led to his death eight months later at 82.

“At age 75, he fell in love, we traveled,” Hayes said. “In our six years together he wrote three full-length books and always made time for fun. He took a piano lesson every week. He swam. He still had a sense of wonder. There was a preciousness in our time together. Oliver said, ‘I don’t so much fear death as I do wasting life.’ ”

Our editors found this article on this site using Google and regenerated it for our readers.