“Sunday Night Football” on NBC ranked No. 1 among all prime time television shows for the 2016-17 season, which concluded Wednesday, marking its sixth consecutive year at the top.

That tied “American Idol,” from 2005-06 through 2010-11, for the longest such streak in American TV history.

advertisement | advertise on newsday

“Sunday Night Football” averaged 20.3 million viewers and 11.4 percent of homes.

“The Cosby Show” was No. 1 for five years in a row in the late 1980s, as was “All in the Family” in the early 1970s.

There never had been a sports show at No. 1 before “SNF” began its streak in 2011-12.