Stephen Colbert has dominated late-night television during the Trump presidency. Now he’ll get a shot at staying on top well past the 2020 election.

CBS announced on Thursday that it had agreed to a contract extension with Mr. Colbert that will keep him as the host of “The Late Show” through August 2023. He was previously signed through August 2020.

The move was a no-brainer for CBS. Mr. Colbert is, by far, the most-watched late-night host.

In the current television season, Mr. Colbert is averaging 3.1 million viewers, compared with the 1.8 million that both Jimmy Fallon’s “The Tonight Show” on NBC and “Jimmy Kimmel Live!” on ABC attract.

Mr. Colbert won the 2018-19 season in the demographic of adults under 50 prized by advertisers, narrowly beating Mr. Fallon in that category. In the season now underway, Mr. Fallon and Mr. Colbert are tied in the ratings among young adults.