Bill Daily, a comic actor best known for his second-banana roles and off-kilter style of humor on two long-running television sitcoms, “I Dream of Jeannie” and “The Bob Newhart Show,” died Tuesday at his son’s home near Santa Fe, N.M. He was 91.

His son, J. Patrick Daily, confirmed the death and said there was no specific cause.

Mr. Daily began his career as a musician, writer and director and did not start acting until he was well into his 30s. His nervous manner and eccentric, out-of-left-field comic style made him a fan favorite on the popular but paper-thin “I Dream of Jeannie” in the 1960s and the brainy, sophisticated “Bob Newhart Show” in the 1970s. He later played a psychiatrist on the 1980s sitcom “ALF.”

He excelled as a clueless, bumbling character who often stole the scenes in which he appeared opposite Larry Hagman and Barbara Eden, the stars of “Jeannie,” and Newhart and Suzanne Pleshette in “The Bob Newhart Show.”

On “Jeannie,” which aired from 1965 to 1970, Mr. Daily was cast as Maj. Roger Healey, an astronaut whose best friend was another astronaut, Tony Nelson, played by Hagman. Nelson was the “master” of a shapely 2,000-year-old genie played by Eden.

The highlights of many episodes were the comic scenes between Hagman and Mr. Daily, which they often improvised. The sitcom remains popular on nostalgia channels, 50 years after it first aired.

After guest roles in other programs, including “The Mary Tyler Moore Show,” Mr. Daily landed a featured part in “The Bob Newhart Show” as the neurotic next-door neighbor of Newhart’s character, psychologist Robert Hartley, and his wife, played by Pleshette.

Notable deaths in 2018 and 2019: Nipsey Hussle, George H.W. Bush, Stan Lee, John McCain, Aretha Franklin and other famous faces we’ve lost

Nipsey Hussle, a Grammy nominated rapper who sought to revive South Los Angeles, died at age 33 on March 31. Read the obituary (Matt Winkelmeyer/Getty Images for Warner Music)

As Howard Borden, Mr. Daily was continually barging into the Hartleys’ apartment, describing his latest predicament. He uttered the phrase “Hi, Bob” 118 times during the sitcom’s run from 1972 to 1978.

Mr. Daily’s mere appearance at the Hartleys’ door, with his awkward gait and hand gestures, was often enough to elicit laughter.

“Bill was totally unaware of how he came off,” one of the show’s writers, Tom Patchett, told the Hollywood Reporter. “I asked him once, ‘Where’d you come up with that silly walk?’ He said, ‘What are you talking about?’ I said, ‘The way you lope into the room like a giraffe.’ He said, ‘That’s my walk.’ ”

Howard was beset by a long list of fears and other problems and was clueless about all of them. In one running joke, he was always out of food. In one episode, he gets up from the dinner table to get dessert.

“Howard, how long will dessert take?” Newhart asks.

“Well, not too long,” Mr. Daily replies. “I just have to go and buy it at the store.”

“Get back here, Howard.”

Another time, Newhart’s character confesses that he has doubts about his career: “Howard, I guess I’ve just, you know, lost my ability to communicate with people.”

“Yeah, well,” Howard says, “I don’t understand what you’re saying.”

The writing on the “Newhart Show” was so subtle, Mr. Daily said, that viewers had to pay close attention to understand the humor.

“People on the street stop me and say, ‘Hi, Howard,’ ” he told the Toronto Star in 1988. “They know that character, not me.”

William Edward Daily was born Aug. 30, 1927, in Des Moines. His father abandoned the family shortly after his birth, and his mother worked in factories.

He grew up mostly in Chicago, where he became adept at music and humor, in part to mask his dyslexia, which made reading difficult. He became friends with Newhart in his teens, when both of them worked at a bowling alley.

By the time he was 16, Mr. Daily was playing bass in jazz bands and writing comedy routines for his group. He played in the band of an early precursor of the “The Tonight Show” in the late 1940s.

After serving in the Army during the Korean War, Mr. Daily began working in television in Chicago as a writer, announcer, floor manager and director. All the while, he was writing and performing stand-up comedy inspired by Bob Hope and Jack Benny. In one of his routines, he played a ventriloquist whose dummy refused to speak.

He later became a writer and director for daytime talk-show host Mike Douglas in Cleveland, then moved to California in the early 1960s to become an announcer and writer for variety-show host Steve Allen.

Mr. Daily had small acting roles on the sitcoms “Bewitched” and “My Mother the Car” before Sidney Sheldon, the creator of “I Dream of Jeannie,” tapped him to play Maj. Healey.

In the 1980s, Mr. Daily was cast as the lead in several comedy series, including “Aloha Paradise” and “Starting From Scratch,” that were soon canceled. He had a recurring role on “ALF,” a late-1980s comedy about a furry creature arrived on earth from outer space.

In the 1980s, he moved to Albuquerque, where he was creative director of a theater and briefly had a radio show.

His marriages to Patricia Anderson and Vivian Sanchez ended in divorce. His third wife, the former Rebecca Duemler, died in 2010. A daughter from his first marriage, Kimberly Daily, died several years ago.

Survivors include his son, J. Patrick Daily, a motion-picture key grip, of Lamy, N.M.

Mr. Daily appeared in dozens of roles in other shows, but he remained best known for his quirky oddball characters.

In one episode of “The Bob Newhart Show,” Howard returns home to find that his apartment has been robbed of everything but a broken vacuum cleaner.

“I don’t know what to do,” he says. “I mean . . . how do you decorate an apartment around a vacuum cleaner?”