Preferably not counting soap operas since there are a few actors who’ve played the same characters for 50 years or so, though they’re mainly cameos these days.
On TV, Kelsey Grammer played Frasier Crane continually for 20 years on CHEERS and FRASIER, and a few of his CHEERS co-horts who made guest appearances on FRASIER did so almost as long. Bebe “Lilith” Neuwirth made the most appearances as her CHEERS character after CHEERS was cancelled, with George “Norm” Wendt, John “Cliff” Ratzenberger, Rhea “Carla” Perlman, and a couple of lesser regulars appearing in character late in the series (which means technically they played their characters for 20 years) with earlier guest appearances by Woody Harrelson, Shelley “Diane” Long, and Ted “Sam Malone” Danson). Does anybody match this in prime time?
In movies, Sean Connery played James Bond in 1962 and again in 1983 (with Bond films starring himself, Roger Moore, George Lazenby and David Niven in between). Has anybody played lead as a film character for more than 20 years?
David Llewellyn played Q for more than 30 years- is that a record?
I can think of several people who played a stage character for more than 30 years (Hal Holbrook has played Mark Twain for 50+ years, far longer than Sam Clemens did, while Yul Brynner played the King for about 30 years and Sarah Bernhardt went 40 or more with several characters [including the teenaged Joan of Arc]). Screen though is nowhere near as forgiving of age lines.
William Shatner played James T. Kirk on TV and in movies from 1966 to 1994 (Star Trek: Generations). If you count video game voiceovers, his last performance as Kirk was in 2006.
Mel Brooks and Carl Reiner have been doing their 2000 Year Old Man routine since 1961, including a lot of TV appearances over the years. They haven’t released a new routine since 2000, but even so, that’s 39 years.
Jackie Gleason created the character of Ralph Kramden for a sketch in 1951. The Honeymooners ran as sketches, as a prime time series, variety shows and finally ending as a series of specials in 1978.
The Adventures of Ozzie and Harriet debuted on radio in 1944 and moved to TV in 1954. That show ran until 1966 and another version with Ozzie and Harriet ran in 1973-1974.
Freeman Gosden and Charles Correll first played Amos and Andy on radio in 1928, While a TV version used different actors, Gosden and Correll continued to play the parts on radio until 1960.
Larry Fine and Moe Howard played the same characters starting in vaudeville days, going into movies in 1933 and lasting until 1970, so that 37 years in films alone.
Jack Benny played the same character starting in radio in 1932, then transitioning to TV and continuing in his own show until 1965 – 33 years.
Oh yeah, and come to think of it, Leonard Nimoy will be playing Mr. Spock in the upcoming Star Trek movie, and he played the character in the 1965 Star Trek pilot The Cage, so his time in that role spans 1965 to 2009 (44 years).
Bill Roache has played Ken Barlow in British soap Coronation St for 49 years. Given that it’s been on several days a week he’s probably had the most airtime as a single character by far. According to Wikipedia
If we DO include soap operas, Helen Wagner played Nancy Hughes in the premiere episode of As The World Turns in 1956 and still appears occasionally as that character today. So that would be 53 years.
They write around them. Soaps are never on hiatus. However, most of the time there is no “star” who has to be onscreen every day. The casts tend to be ensembles, and the writers can write for whatever characters they want, so if an actor wants to take a vacation, the writers can just focus on other characters’ storylines for a while. The vacationing actor can also film scenes prior to going on vacation that will air during the vacation week(s).
Writers will also sometimes send the character on vacation, and have them interact with the cast “back home” via phone calls (and usually the vacationing actor will have prerecorded his/her end of the calls, since s/he’s not actually in the shot with anyone else). This has been done for actor pregnancies that weren’t written into the storyline, too.