Fred Willard, a comic actor known for his scene-stealing, heavily improvised work with filmmaker Christopher Guest and his Emmy-nominated appearances on the sitcoms “Modern Family” and “Everybody Loves Raymond,” died May 15 at his home in Los Angeles. He was 86.

His agent, Michael Eisenstadt, confirmed the death but did not give a precise cause.

Mr. Willard was a master at playing ridiculous, slightly smarmy characters prone to rambling monologues. While other performers made a name for themselves as leading men or character actors, he excelled at playing loudmouths — sometimes for just a few minutes in a single scene — who left audiences howling and cast members breaking character.

“Everyone has a little trapdoor in their mind where you go to say something and then you think no, you shouldn’t say this,” he told Entertainment Weekly in 2001. “I just open that door.”

Mr. Willard worked frequently with Guest, who starred in “This Is Spinal Tap” (1984), a parody of rock documentaries, and who later assembled a loose repertory group that included Mr. Willard, Eugene Levy, Michael McKean, Catherine O’Hara and Parker Posey.

Together, they helped popularize the “mockumentary” genre, examining — and skewering — small-town theater productions in “Waiting for Guffman” (1996), dog shows in “Best in Show” (2000), folk music in “A Mighty Wind” (2003) and the Hollywood awards season in “For Your Consideration” (2006).

Mr. Willard, a veteran of the Chicago comedy group the Second City, improvised virtually all of his dialogue in those films. In “Spinal Tap,” named for a fictional rock group that turns the volume knob on their amplifiers all the way “up to 11,” he played an Air Force officer who welcomes the band to a military base where they’re scheduled to perform.

“We are such fans of your music, and all of your records,” he says. “I’m not speaking of yours personally, but the whole genre of the rock and roll, all the exciting things that are happening.”

In “Waiting for Guffman,” he played Ron Albertson, a local travel agent with Hollywood ambitions and a bad Henry Fonda impression. In “A Mighty Wind,” he was Mike LaFontaine, a spiky-haired former television star with a set of hokey catchphrases (“Hey, wha’ happened!”) who says that he was “the first one to use the phrase ‘I don’t think so!’ ”

Mr. Willard’s crowning achievement was arguably “Best in Show,” as the dog-show announcer Buck Laughlin, who muses about miniature schnauzers: “You’d think they’d want to breed ’em bigger, wouldn’t you? Like grapefruits or watermelons.” Marveling at a judge examining the gait of a beagle, he declares: “Good way to judge a woman, have her run away from you and then run back.”

“In scripted situations, he doesn’t get a chance to show the gift that he’s got that nobody else has,” Guest told the Philadelphia Inquirer in 2006. “He has this Fred energy, which is not like anyone else’s in the world. Fred is from another place. Unfortunately, we don’t know where that is.”

Mr. Willard appeared in more than 300 movies and television series, and was a fixture of late-night talk shows hosted by Jay Leno, Conan O’Brien and Jimmy Kimmel. He was initially known for playing a talk-show host character, Jerry Hubbard — the dimwitted sidekick to Martin Mull’s host Barth Gimble — on “Fernwood 2 Night,” a satirical series that premiered in 1977 and became known as “America 2-Night” during its second season.

“Jerry’s strength was he would say anything that came to his mind. … I’m completely the opposite, I hold things in more,” Mr. Willard said in a 2012 interview with the Television Academy Foundation. “If I’m in a group of people I’ll just sit back and observe everyone.”

He later appeared in comedies including “Fun With Dick and Jane” (1977), “First Family” (1980), “Austin Powers: The Spy Who Shagged Me” (1999) and “Anchorman” (2004), as a television executive who is always on the phone addressing his son’s behavioral issues, including holding a marching band hostage and “firing a bow and arrow into a crowd — you know how kids are.”

Mr. Willard also received three Emmy Award nominations for playing strait-laced father-in-law Hank MacDougall on the CBS sitcom “Everybody Loves Raymond.” In 2010, he received a fourth Emmy nomination for ABC’s “Modern Family,” as Frank Dunphy, the wisecracking father of Ty Burrell’s Phil Dunphy. His character died in the show’s final season, which ended in April.

Frederick Charles Willard Jr. was born in Cleveland on Sept. 18, 1933, and grew up in suburban Shaker Heights. His father worked in finance and died when Fred was 12; after his mother remarried, he was sent to a military school in Kentucky.

Mr. Willard played baseball at the Virginia Military Institute, where he received a bachelor’s degree in 1955, and turned to acting after serving in the Army. Performing in a Tennessee Williams one-act play, he inadvertently made audiences laugh with his line deliveries. “I didn’t mean to be funny,” he later told the Los Angeles Times. “I have always been more relaxed around comedy.”

He performed as a duo with Vic Greco, appeared on Johnny Carson’s “Tonight Show” with a comedy group known as the Ace Trucking Company and made his TV debut as an actor in 1966, appearing in the Western sitcom “Pistols ’n’ Petticoats.” Three years later, he was featured in an acclaimed off-Broadway production of Jules Feiffer’s black comedy “Little Murders.”

After the success of “Fernwood 2 Night,” Mr. Willard hosted the NBC reality series “Real People” and appeared in shows including “Family Matters” and “Lois & Clark: The New Adventures of Superman.” In the 1980s sitcom “D.C. Follies,” he played a Washington bartender who serves a rotating cast of politicians and celebrities, all played by puppets.

Mr. Willard also maintained a lasting creative partnership with Mull, appearing with the actor in the documentary parody “The History of White People in America” (1985) and partnering with him to play one of TV’s first openly gay couples on the sitcom “Roseanne.”

In 2012, he made headlines after being arrested for lewd conduct at an adult movie theater in Hollywood. He denied doing anything wrong and avoided a trial after completing a diversion program for minor sexual offenses. Joking with late-night host Jimmy Fallon after his arrest, he said, “It’s the last time I’m going to listen to my wife when she says, ‘Why don’t you go out and see a movie?’ ”

His wife of 50 years, the former Mary Lovell, died in 2018. Survivors include his daughter, Hope Mulbarger, and a grandson.

Mr. Willard’s early work included a starring role in the TV movie “Space Force” (1978), which he spoofed on Kimmel’s late-night show after President Trump announced the creation of a space-warfare branch of the military. A Netflix series of the same name is slated to premiere later this month, with Mr. Willard playing the father of Steve Carell.

“If I have to play an obnoxious character, [I] try to find a redeeming feature of him. The most obnoxious people in the world were people and they had had a reason for doing what they did,” he told a public-television interviewer in 2012. He added, “I love to play the character who has no cares, oblivious to everything. It’s a kind of a release. It’s the kind of character I would love to be.”