“American Idol” kept Fox atop the primetime demo leaderboard last week but CBS closed the gap — and won in total viewers — thanks to March Madness.

The NCAA men’s basketball tournament is tracking at a six-year high, with viewership across CBS, TBS, TNT and TruTV averaging 9.4 million viewers heading into this weekend’s Final Four, which the Eye will air exclusively.

“American Idol” again claimed the top spots on the demo chart with its two nights, but ABC’s strong premiere of “Dancing With the Stars” wasn’t far behind.

ABC’s “Modern Family” and CBS’ “NCIS” were among the standouts on the scripted side. And the week also saw good finales for MTV’s “Jersey Shore” and ABC Family’s “Pretty Little Liars” and continued strong scores for Lifetime’s “Army Wives.”

As the week closed, HBO’s five-part miniseries “Mildred Pierce” opened Sunday to 1.27 million viewers, a figure in line with expectations, the pay cabler said. Last year’s “The Pacific” opened to 3.1 million, “John Adams” drew 1.8 million and “Generation Kill” did 1.1 million.

Overall for the March 21-27 frame, according to Nielsen estimates that include same-night DVR playback, Fox led in adults 18-49 with a 3.1 rating/9 share, with CBS within shouting distance (2.8/8) and well ahead of ABC (2.1/6), NBC (1.7/5), Univision (1.6/5) and top cablers TBS and USA (both 0.9/2). CBS pulled to within a tick of Fox in 25-54 (3.5/10 vs. 3.6/10) and won rather comfortably in total viewers (10.1 million to 8.9 million for Fox).

For Fox, Wednesday’s two-hour “American Idol” was the week’s No. 1 show in most broad categories (7.9/22 in 18-49, 23.95 million viewers overall), and Thursday’s results show ranked second in 18-49 (6.4/20, 21.30m). For the season, the music megahit is within 9% of last year’s average in adults 18-49 (8.6 vs. 9.4) and is just 1% below last year’s pace in total viewers (24.9 million vs. 25.3 million).

In a week in which “Glee,” “Bones” and “Family Guy” aired repeats, “House” (3.4/10, 9.49m) and “The Simpsons” (2.8/8, 6.05m) were the net’s lone top-25 scripted skeins in 18-49. CBS was paced by “NCIS” (3.8/12, 19.46m), the week’s top drama in 18-49 and the No. 1 scripted program in 25-54 (5.4/15) and total viewers. Also of note for the net were top-20 perfs by Sunday series “60 Minutes” (3.1/10 in 18-49, 14.81m), “The Amazing Race” (3.2/9, 10.96m) and “Undercover Boss” (3.2/9, 11.87m), which aired behind the week’s top-rated college basketball game (5.3/19, 15.08m for Kentucky-North Carolina).

At ABC, “Dancing With the Stars” (5.3/15, 22.66m) may have been down from last spring’s highly rated preem, but it logged the best scores for any regular series of 2011 (excluding “American Idol”). Also for the net, “Modern Family” (4.4/12, 10.90m) was the week’s No. 1 scripted show in 18-49, and “Grey’s Anatomy” returned with a top-10 finish (3.7/10, 10.28m).

On Friday, “Shark Tank” opened its second season with nothing-special scores (1.2/4, 4.65m).

NBC was led by “The Office” (3.4/10, 7.07m) and reality series “The Biggest Loser” (3.0/9, 8.33m) and “Celebrity Apprentice” (3.0/8, 8.58m), with the latter hitting a season high.

In cable, TBS caught USA in 18-49 thanks to college hoops action, led by Thursday’s Florida-BYU game (1.9/6, 5.26m). USA was paced by “WWE Raw” (2.0/6, 5.27m), while its Thursday drama “Fairly Legal” ended its first season with ho-hum scores (0.9/2, 4.08m).

MTV’s “Jersey Shore” wrapped its third season a winner (4.1/11 in 18-49, 7.61m), ranking fifth among all primetime shows for the week in 18-49 and first in persons 12-34 (6.2/21); it drew 25% more viewers than the show’s second-season finale in October (5.1 million).

Also ending on a strong note was ABC Family’s “Pretty Little Liars” (1.3/4, 3.64m), which drew its second largest aud to date and won its Monday 8 o’clock hour in femmes 12-34 (4.7/17). In this demo, it ranks as cable’s No. 1 scripted series for the season.

At Lifetime, “Army Wives” continued its hot start to the season (1.7/5, 4.79m), hitting series highs with an episode in which the tribe learned of the death of Jeremy Sherwood (Richard Bryant); it’s the No. 1 drama on basic cable for 2011 in 18-49 and key women demos.

Elsewhere, it was another big Monday for History with “Pawn Stars” (2.4/7, 6.45m) and “American Pickers” (1.8/5, 5.61m). Wednesday saw good scores for dueling 10 p.m. reality shows “Top Chef” on Bravo (1.3/4, 2.38m) and “Real World” on MTV (1.3/4, 2.16m), and Food Network’s “Chopped” ended the week with similar demos (1.3/4, 3.26m); MTV’s “Teen Mom” racked up more big ratings on Tuesday (2.5/7, 4.39m), beating the major nets in 18-49 and dominating in persons 12-34 (3.4/11); Disney Channel’s original Friday telepic “The Suite Life Movie” drew more viewers than any other scripted program on TV that night; and Spike scored Saturday with “UFC: Fight Night Live” (1.2/5, 2.17m).

In other ratings news, “CBS Evening News” saw its first-quarter ratings dip to their lowest since Nielsen began rating the program in 1992. “News” was watched by an average of 6.43 million total viewers and 1.98 million adults 25-54 in the first quarter of 2011, down from 6.45 million and 2.02 million a year ago.

The dip comes at a time when anchor Katie Couric is in negotiations with CBS and other interested parties regarding her role at the net. Couric, who will likely leave the newscast in June at the end of her contract, is said to have been feeling confined in the job for quite some time and is looking to create a syndicated show, possibly with CBS, possibly with NBC or Time Warner.

ABC’s “World News With Diane Sawyer” was the only evening newscast to show year-on-year gains, narrowing the gap with NBC’s “Nightly News With Brian Williams,” the category leader. ABC posted an average of 8.65 million total viewers and 2.43 million adults 25-54 (up 4% and 2%, respectively); NBC ranked No. 1 with 9.81 million total viewers and 2.94 million in the demo.

(Sam Thielman and Stuart Levine contributed to this report.)