Patton Oswalt is recounting the tragic day he found his wife, Michelle McNamara, dead — and speculating that the cause of her death might have been related to an overdose.

In a heartbreaking interview with The New York Times, the 47-year-old comic described what he calls “the second worst day of his life” — the first being when he had to tell their 7-year-old daughter, Alice, that her mother had died.

McNamara, 46, was writing a book about a serial rapist and killer at the time — working long days and nights to solve the crimes of the person she had coined “The Golden State Killer.”

It was a case that led to anxiety and nightmares that kept McNamara up at night. So worried about her health, Oswalt suggested she take a night to “sleep until you wake up.”

On April 21, McNamara took some Xanax and went to sleep. She never woke up.

The next morning, Oswalt remembered waking up early to get his daughter Alice dressed, packed and off to school. On the way home, he picked up an Americano coffee and left it on McNamara’s bedside table — around 9:40 a.m., he said.

He then went to work in his home office — answering emails, sending some tweets about Prince’s death, and handling a few phone interviews.

It was 12:42 p.m., he said, when he checked to see if his wife was up yet. She was still in bed — not breathing. The paramedics pronounced her dead on the scene.

While a cause of death has still not been declared by the coroner’s office, Oswalt said he believes the Xanax is to blame.

“I have a feeling it might have been an overdose,” he told The Times. “That’s what the paramedics there were saying while I was screaming and throwing up.”

He said at the time he believed he was living a nightmare — and spent time trying to wake himself up. “I was literally blinking trying to get out of this,” Oswalt confessed.

Telling Alice the next day, Oswalt said she related the experience to Pixar’s Inside Out. “I guess Sadness is doing her job right now,” he recalled she said.

In the six months since her death, Oswalt revealed he has been crippled by mourning. Already someone who suffers from depression, the Ratatouille star said he’s been to counseling and has read books like C.S. Lewis’ A Grief Observed and Stephen King’s On Writing for support.

He also drank heavily — though “found out the hard way these past few months that alcohol doesn’t really help.”

One thing that has helped has been standup comedy. He’ll return to the stage on Nov. 3 to perform at the New York Comedy Festival.

“I’ll never be at 100 percent again,” he said. “But that won’t stop me from living.”