"Simpsons" star Hank Azaria paid tribute to longtime friend Matthew Perry, crediting Perry for helping him get sober and recalling his sense of humor.

"Matthew Perry said that he wanted to be remembered as someone who helped people get sober, even more than he wanted to be remembered as a very funny, famous Friend. I think he’ll be remembered as both," Azaria wrote in an opinion piece for The New York Times.

"I know that I will always think of him that way. We met almost 40 years ago, and he was, by far, the funniest friend I ever had. He also was the person who helped me get sober."

Azaria shared that Perry took him to his first Alcoholics Anonymous meeting in 2005, recalling his gentle guidance through the process.

MATTHEW PERRY FOUNDATION LAUNCHES AFTER ACTOR’S DEATH TO HELP PEOPLE STRUGGLING WITH ADDICTION

Matthew Perry and Hank Azaria posing

Hank Azaria credited Matthew Perry with his sobriety, recalling the "Friends" star took him to his first AA meeting in 2005. (J. Vespa)

"It’s very hard to imagine how going into a room like that is somehow going to make you want to stop drinking or make you feel better," he recalled. "And he looked at me and said in his Matthew, half-joking, very loving way: ‘It’s something, isn’t it? God is a bunch of drunks together in a room.’"

Unsure of what he meant at the time, Azaria later realized it meant that he, Perry and anyone else struggling wasn't alone, and their fellow AA members could be the "higher power" the program often refers to.

"I saw close up how hard he would hit the bottle and pills. And I felt like, ‘Well, gosh, if he can stop, maybe I can,’" Azaria wrote.

Perry’s sense of humor connected them further and helped both in their recovery.

"As funny as he was on ‘Friends’ — and he was — he was breathtakingly, hysterically unbelievable to be with in person," Azaria wrote. "In any situation, he’d just start finding what was funny about it, beat it into the ground until it wasn’t funny anymore, take that as a challenge and then find a way to bring it back so that it was not just funny but riotous.

Matthew Perry and Hank Azaria smiling together

Azaria said he was inspired by Perry's sobriety journey.  (J. Vespa/WireImage)

MATTHEW PERRY WANTED TO BE REMEMBERED FOR HELPING THOSE WITH ADDICTION, NOT JUST FOR HIS ‘FRIENDS’ ROLE

"Many times I had to beg him to stop because it was physically painful to laugh that hard for that long."

One instance of Perry’s humor at work, according to Azaria, included silly behavior in a public restroom.

"Whenever we went into a public restroom together, I’d beg him — I’d say, ‘Please don’t do it, Matthew.’ He’d say, ‘OK.’ Then he would proceed to go into a stall and start making little high-pitched straining "ow" noises, that would build into a crescendo of a man full-volume screeching as if he were giving birth to whatever was coming out of him in there," Azaria wrote.

Matthew Perry and Hank Azaria in conversation with each other.

Azaria called Perry his "funniest" friend, saying sometimes it "was physically painful to laugh that hard for that long." (Carlo Allegri/Getty Images)

CLICK HERE TO SIGN UP FOR THE ENTERTAINMENT NEWSLETTER

Another regular occurrence was visiting McDonald’s drive-thrus together, where Perry would "ask the person on the other side of the speaker, ‘Do you know what Grimace is?’ After getting a ‘no,’ he would offer, ‘I think it’s a purple shake that has no cup.’ There was usually a pause followed by a very confused, ‘May I take your order, sir?’"

Azaria said as funny as Perry could be, he was also "surprised" by "his profound understanding of human nature and human flaws — his own flaws and those of others."

"Tragically, I think he had a lot more compassion for me and for everybody else than he did for himself," he added.

A photo of Matthew Perry

Azaria said he felt Matthew Perry "had a lot more compassion for me and for everybody else than he did for himself." (Mike Pont/WireImage)

LIKE WHAT YOU’RE READING? CLICK HERE FOR MORE ENTERTAINMENT NEWS

The actor concluded that Perry had "helped so many people" with his honesty and considers himself "blessed" to experience both Perry’s friendship in real life and the universal feeling many felt watching him on "Friends."

Perry died Oct. 28 at age 54 from an apparent drowning. He was reportedly found by his assistant in a hot tub at his Pacific Palisades home. A representative for the Los Angeles County Medical Examiner-Coroner’s office confirmed to Fox News Digital an autopsy was completed, and toxicology results are pending. 

CLICK HERE TO GET THE FOX NEWS APP

Azaria shared an earlier tribute on Instagram after Perry’s death, saying they were "more like brothers for a long time."