Sean Hannity has been the king of Fox News for two and a half years, the highest-rated host on the highest-rated cable news channel. His dominance has withstood network management changes and the vicissitudes of a news cycle driven by President Trump, the anchor’s close political ally.

In April, however, Mr. Hannity slipped back.

For the first time since moving to the 9 p.m. time slot in October 2017, “Hannity” ranked second in Fox News’s prime-time lineup. “Tucker Carlson Tonight” ranked ahead, with an average nightly audience of 4.56 million viewers, outpacing the 4.39 million who tuned in for Mr. Hannity, Nielsen said on Tuesday.

It is difficult to pinpoint the reasons for a shift in ratings, which are closely inspected by TV executives and anchors (not to mention Mr. Trump). But this month, coronavirus lockdowns and the president’s freewheeling White House briefings profoundly altered viewer dynamics at Fox News.

In April, the network’s daily viewership — which usually peaks in prime time — surged in the hours when Mr. Trump spoke from the White House. Bret Baier’s newscast, “Special Report,” drew a whopping 5.26 million viewers, topping all of Fox News’s prime-time hosts for the first time and even beating general-interest TV fare like ABC’s “Shark Tank.”