David Letterman is planning to outlast Jay Leno in late-night television.

CBS Corp. and Letterman have agreed to a four-year contract extension that will keep the comic on the "Late Show" through the 2009-10 television season, according to two executives familiar with the negotiations who spoke on condition of anonymity Thursday because the deal wasn't fully done.

That would keep Letterman, 59, on the air past NBC's planned 2009 hand-off of the "Tonight" show job from Leno to Conan O'Brien.

Leno and Letterman have been competing in late-night since 1993, after NBC chose Leno for "Tonight" and Letterman jumped to CBS.

For most of that time, Leno has had the upper hand in the ratings. For the past year, Leno has averaged 5.71 million viewers each night to Letterman's 4.16, according to Nielsen Media Research. That gap is more than 200,000 viewers wider than the previous year, mostly due to Letterman's audience shrinking, Nielsen said.

Letterman has suffered through health problems in recent years that has led to some speculation that he might not want to do the job much longer. Heart surgery in 2000 and a case of shingles in 2003 kept Letterman off the air for brief periods.

But Letterman has apparently concluded that he's up to the challenge of competing with O'Brien, who took over Letterman's NBC show after the move to CBS.

NBC announced two years ago its unusual long-off succession plan, done primarily to prevent O'Brien from moving to another network.

Spokesmen for CBS Entertainment and Letterman would not comment on negotiations.