Acclaimed for his work on “The Mary Tyler Moore Show” and “The Cosby Show,” he also made a crucial casting decision about “The Golden Girls.”Jay Sandrich, a prolific sitcom director who won Emmy Awards for the two series he worked on most often, “The Mary Tyler Moore Show” and “The Cosby Show,” died on Wednesday at his home in Los Angeles. He was 89.The cause was dementia, his wife, Linda Sandrich, said.Mr. Sandrich did not think of himself as funny, but he knew how to guide a cast of comic actors through half-hour episodes. He understood the mechanics of directing (move the cameras, not the actors) and knew how to make scenes work.“Sitcom directors have a reputation as traffic cops because it’s a writers’ medium,” James Burrows, whose directing credits include “Cheers,” “Frasier” and “Will & Grace,” and who considered Mr. Sandrich a mentor, said by phone. “But Jay taught me to speak up and say what I thought so that you’re contributing to the show, not just parroting what everybody wants.”By 1970, Mr. Sandrich was a sitcom veteran, but he did not believe he had done “anything great”; his credits at that point included “He & She,” “That Girl,” “The Ghost & Mrs. Muir” and, perhaps most notably, “Get Smart.” Then, after another director dropped out, he was asked to direct the pilot episode of “The Mary Tyler Moore Show.”When the cast gathered for a run-through in front of an audience, nothing worked.“It was a disaster,” he told the Television Academy in an interview in 2001. “I don’t think we got six laughs.”Afterward, he told the cast to trust the material and keep rehearsing. By the time the episode was taped, the performances had sharpened and the laughs had been found.The cast of “The Golden Girls,” from left: Rue McClanahan, Bea Arthur, Estelle Getty and Betty White. It was Mr. Sandrich who suggested that Ms. McClanahan play the role originally intended for Ms. White, and vice versa.Walt Disney Television, via Getty ImagesReferring to a moment in the scene where Mary Richards, played by Ms. Moore, is interviewing for a television news job with Lou Grant, played by Ed Asner (who died last month), he said, “Ed, I remember, when he said, ‘You’ve got spunk — I hate spunk,’ he did it so loud” that the audience gasped. “He had found the perfect level.”Over the next seven years, Mr. Sandrich directed 118 more episodes of “The Mary Tyler Moore Show,” including the series finale, and won two Emmys for his work on the show. He also directed other series under the banner of Ms. Moore’s company, MTM Enterprises, including “Rhoda,” “The Bob Newhart Show,” “Phyllis” and “Lou Grant.”In the late 1970s, he directed 53 episodes of “Soap,” Susan Harris’s parody of soap operas. In 1980 he directed the movie “Seems Like Old Times,” written by Neil Simon and starring Goldie Hawn and Chevy Chase. It was a hit, grossing $44 million — about $139 million in today’s dollars — but he never made another feature film.Jay Henry Sandrich was born on Feb. 24, 1932, in Los Angeles. His father, Mark, was a director whose films included the Fred Astaire-Ginger Rogers musical “Top Hat.” His mother, Freda (Wirtschalter) Sandrich, was a homemaker.As a child, Jay saw snow falling for the first time — on the set of “Holiday Inn” (1942), with Astaire and Bing Crosby, which his father was directing. It was an exciting sight, even if the snow was plastic.Goldie Hawn in “Seems Like Old Times” (1980), the only feature film Mr. Sandrich directed.Columbia Pictures, via Getty ImagesAfter graduating in 1953 from U.C.L.A., where he studied theater arts and film, he joined the Army and shot training films for the Signal Corps.Following his discharge, he wrote to W. Argyle Nelson, the head of production at Desilu Productions — Lucille Ball and Desi Arnaz’s production company — and he was hired as a second assistant director, working on “I Love Lucy,” “Our Miss Brooks” and “December Bride.” He later discovered that he had gotten the job because Mr. Nelson had been an assistant to his father on a film years earlier. Mr. Sandrich went on to become an assistant director on “The Lucy-Desi Comedy Hour,” the successor to “I Love Lucy,” from 1957 to 1959.He had similar positions on “The Dick Van Dyke Show” and on “Make Room for Daddy,” starring Danny Thomas, where he started his directingcareer.“I remember waking up in the middle of the night,” fearful before directing his first episodes of “Daddy,” he told the Television Academy. “I was so scared. Nobody was going to listen to me.”People listened to him for the next 40 years.In the 1980s, he directed 100 episodes of “The Cosby Show,” for which he won two Emmys. In 1985, he directed the pilot for “The Golden Girls,” and he played a critical role in casting Betty White as Rose, the naïve character, and Rue McClanahan as the libidinous Blanche, the opposite of what had been originally planned — in part because Ms. White had already played a similar role, Sue Ann Nivens, on “The Mary Tyler Moore Show.”“Jay Sandrich, in his genius, said if Betty plays another man-hungry, they’ll think it’s Sue Ann revisited. So let’s make her Rose,” Ms. White said at a 2006 “Golden Girls” reunion in Los Angeles staged by the Paley Center. She added, gesturing to Ms. McClanahan, “They got a real neighborhood nymphomaniac to play Blanche.”Mr. Sandrich at an Academy of Television Arts and Sciences panel discussion in Los Angeles in 2013. His TV career began in the 1950s and continued into the 21st century. Frank Micelotta/Invision for Academy of Television Arts and Sciences, via Associated PressMr. Sandrich continued to work into the 21st century. His last assignment was an episode of “Two and a Half Men” in 2003.He married Linda Silverstein in 1984. In addition to her, he is survived by his daughter, Wendy Steiner; his sons, Eric and Tony; and four grandchildren. His marriage to Nina Kramer ended in divorce.Mr. Sandrich’s association with “The Mary Tyler Moore Show” ended when the series itself did, in 1977. He later recalled that as the cast rehearsed the last episode, Mr. Asner’s emotional line, “I treasure you people,” caused tears to stream from Mr. Asner’s eyes.And when Ms. Moore talked about how much her co-workers meant to her, Mr. Sandrich said, “My only direction to her was to hold off crying as long as you can.”“If you see the show,” he added, “you see the tears well up and I started crying and the audience started crying.” More