James Michael Tyler, an actor best known for his role as the love-smitten barista Gunther on “Friends,” died Oct. 24 at his home in Los Angeles. He was 59.

The cause was prostate cancer, said his manager, Toni Benson.

Mr. Tyler appeared briefly in 1990s series such as “Just Shoot Me!” and “Sabrina the Teenage Witch” before being cast as a background character in the second episode of “Friends” in 1994.

Over the show’s multiyear run, he became the most frequently recurring guest star on the series playing Gunther, the Central Perk barista with an unrequited affection for Rachel (Jennifer Aniston).

Mr. Tyler was initially cast while working as a barista at the Bourgeois Pig coffee shop in Los Angeles. He didn’t have a line of dialogue on “Friends” until he had made 33 appearances on the show, according to the 2019 book, “Generation Friends: An Inside Look at the Show That Defined a Television Era.” Over the 235 episodes, Mr. Tyler appeared in 150 of them.

Once “Friends” concluded in 2004, Mr. Tyler made appearances on “Scrubs” and “Modern Music,” and he played himself on an episode of Matt LeBlanc’s “Episodes” in 2012.

Mr. Tyler was born on May 28, 1962, and spent his early childhood in Winona, Miss. He was 11 when his father, a retired Air Force captain, died in a car accident. His mother, a homemaker, also died around that time, of breast cancer. He then moved in with a married older sister in Anderson, S.C

He began acting while attending Clemson University, where he graduated in 1984 with a geology degree. “I was fascinated with kind of being someone else,” he told the Clarion-Ledger of Jackson, Miss. “After I graduated, I had one job offer from Exxon to monitor oil rigs in the Gulf.”

Instead, he received a master’s of fine arts degree from the University of Georgia in 1987, then went to Los Angeles to enter show business.

He wound up working as an extra for $55 a day on “Friends.” One of the producers elevated him to “coffee guy,” he said, when he said he knew how to operate a cappuccino machine from his work at the Bourgeois Pig. Not long after that, the producer asked whether he had any acting experience.

He was given a word of dialogue — “Yes” — and a name, Gunther.

“They gradually created the obsession that my character had with Jennifer’s character, and they sustained that for 10 years,” he told the Jackson newspaper.

After being diagnosed with cancer, Mr. Tyler starred in two short films while undergoing treatment and gave a spoken-word performance of the Stephen Kalinich poem “If You Knew” to help raise awareness for the Prostate Cancer Foundation.

His first marriage, to Barbara Chadsey, ended in divorce. Survivors include his wife, Jennifer Carno.