The long-running CBS sitcom “Everybody Loves Raymond” finally picked up the outstanding comedy statuette that had eluded it at Sunday’s 55th Annual Emmy Awards show.

About to enter its eighth, and possibly last, season, “Raymond” led all series in this year’s kudos race, picking up a total five Emmys. Only TNT’s telepic “Door to Door,” which landed six, did better.

Meanwhile, Emmy voters told HBO’s “The Sopranos” to fugghedabout a sweep, instead awarding NBC’s “The West Wing” a stunning fourth consecutive award for outstanding drama.

HBO still led this year’s overall Emmy tally, winning 18 awards (including totals from the Creative Arts Emmys, held on Sept. 13). That’s down from 24 trophies last year, when the pay cabler tied with NBC for most wins.

Peacock this year ceded the broadcast network lead to CBS, which surprised many by taking home 16 awards — the Eye’s best showing since 1995.

NBC was next with 15 wins, followed by ABC (9), Fox and PBS (7 apiece) and TNT (6).

The outstanding comedy trophy was gravy for “Everybody Loves Raymond,” which had won numerous kudos for acting through the years, but had yet to win the big one.

Exec producer Phil Rosenthal, taking the podium with Emmy in hand, recounted how a studio exec once warned him that the show wasn’t “hip” or “edgy” enough for primetime.

“We’re trying to do a traditional, old-fashioned, well-made, classic kind of sitcom,” Rosenthal said. “He said, ‘Those are all the things we should be avoiding.’ ”

CBS execs will now have to figure out how the Emmy win might impact the fate of the show.

As for the drama award, HBO’s “Sopranos” and “Six Feet Under” may have canceled each other out in the voting process, allowing “The West Wing” to sneak through.

“West Wing” now becomes only the third drama to ever win four outstanding series awards, alongside two other NBC skeins: “Hill Street Blues” and “L.A. Law.” (“Hill Street Blues” was the only show to win four consecutive times until “West Wing” did it again this year.)

Creator Aaron Sorkin, who left the show under fire at the end of last season, kept his speech gracious — and short.

“I want to personally thank everyone behind me,” Sorkin said onstage. “For four years you guys did the TV series of any playwright’s dreams.”

“The Sopranos” may not have won the top prize, but did pick up yet more Emmys for the show’s two stars, James Gandolfini and Edie Falco.

Returning to the nomination stable, Gandolfini and Falco both picked up their third Emmys for their roles as Tony and Carmela Soprano — reclaiming their sweep from two years ago when the duo was last eligible.

“I wish for everyone a working experience like I have on ‘The Sopranos,’ ” Falco said.

While Emmy stuck to the tried and true in its drama selections, voters were more generous in awarding first-time winners on the comedy side.

Besides giving “Raymond” its first-ever win, Emmy named “Will & Grace” star Debra Messing its outstanding actress in a comedy. The win was Messing’s first after four tries.

Also, Tony Shalhoub won his first Emmy — on his first nomination — as outstanding drama actor, for USA’s “Monk.”

“Everybody Loves Raymond’s” Emmy stash started accumulating early in the evening, when supporting thesps Doris Roberts and Brad Garrett both repeated their wins from last year.

The supporting actress in a comedy win was Roberts’ third for “Everybody Loves Raymond” and her second in a row.

“I’m a triple crown winner,” Roberts said. “Three times. Wow. I remember when there were only three channels. For the young people out there, that was many years ago.”

Garrett, meanwhile, picked up his second consecutive award for outstanding supporting actor in a comedy. Tyne Daly won the sixth Emmy in her career, this time for her role as Amy Brenneman’s mother on “Judging Amy.”

“How delightful to see you all again from this aspect,” Daly said. And if the wins by Roberts, Garrett and Daly weren’t enough, Eye execs had to be pleased with Joe Pantoliano’s award for outstanding supporting actor in a drama.

Pantoliano won for HBO’s “The Sopranos,” in a season that saw his character whacked. But Pantoliano returns this fall in the new drama “The Handler” on — you guessed it — CBS.

In one of the shockers of the night, underdog but critical fave “The Amazing Race” took home the only statuette in the outstanding reality/competition program category.

As for the outstanding variety/music/comedy series categories, the little show that could — Comedy Central’s “The Daily Show with Jon Stewart” — became the little show that did.

The show won its first-ever outstanding series award for the category, beating out usual winners like “The Late Show with David Letterman” (which has dominated in recent years).

Most crix agreed that the show had reached a creative pinnacle this year, in part because of its satiric coverage of the war in Iraq.

“It was such a great war for us,” Stewart joked. “It’s weird when you have a show that deals with events and when events get catastrophic your show gets popular. So you do feel like, ‘Hey, war and chaos, woo!'”

“The Daily Show” had earlier won the award for writing in a variety/music/comedy program.

Glancing across the stage at his staff, Stewart cracked wise about how his team of writers all, well, kinda look alike.

“I’ve always felt that diversity is the most important part of a writing staff,” he quipped. “I don’t know if you’ve noticed, but Steve (Bodow) here has a beard, and J.R. (Havlan) isn’t Jewish.”

The one category Stewart didn’t win was outstanding individual performance in a variety/music program, which went to Wayne Brady for his part on ABC’s “Whose Line is it Anyway.”

Brady’s take was the Alphabet net’s only trophy for the evening. It was the first Emmy win out of three nominations for Brady, who beat out big names such as Jon Stewart, Martin Short, Robin Williams and Dennis Miller.

Meanwhile, in the world of TV movies and minis, move over HBO — TNT nearly swept the longform categories, thanks to the telepic “Door to Door.”

“Door to Door,” which revolved around the true story of Bill Porter — a door-to-door salesman born with cerebral palsy — was named this year’s outstanding TV movie, for starters.

The TV movie, which went into the ceremony as this year’s most-nominated longform (with 12 nods), also scored outstanding movie/miniseries Emmys for directing (Steven Schachter), writing (Schachter and William H. Macy) and actor (Macy).

“I’m the luckiest palooka,” Macy said. “I’m so pleased that much of America knows what people in Portland, Oregon know — that Bill Porter is a cool guy.”

It was the first Emmy win for Macy (who had been nominated three times before) and Schachter.

Basic cable also took the outstanding miniseries Emmy, thanks to Sci Fi Channel’s “Steven Spielberg Presents Taken.” The creepy UFO miniseries made it two in a row for Spielberg, whose HBO mini “Band of Brothers” won the award last year.

Maggie Smith won her first Emmy (in three tries) for her role in HBO’s “My House in Umbria.”

And HBO’s “Hysterical Blindness” cleaned up in the supporting thesp categories, as the made-for-TV movie’s Ben Gazzara won for supporting actor, and Gena Rowlands took it home for supporting actress. Both were no-shows at the ceremony.

This was Rowlands’ third Emmy win, out of six noms, and the first win for Gazzara.

Behind-the-camera winners included Christopher Misiano, who won for directing in a drama for his work on “The West Wing.”

For directing in a comedy, Robert Weide scored for “Curb Your Enthusiasm” episode “Krazee-Eyez Killa.”

Weide dedicated it “to my wife Linda, with whom I just lost a $100 bet.”

Also picking up his first Emmy was scribe Tucker Cawley, who won the comedy writing award for “Everybody Loves Raymond.” Cawley won for the episode “Baggage,” which was based on his own argument with his wife over who should put away an empty suitcase.

“This Emmy belongs to everyone on ‘Raymond’ writing staff, but we’ll keep it at my house,” he said.

On the drama side, meanwhile, writing nods went to “The Sopranos” creator David Chase, as well as the show’s Robin Green and Mitchell Burgess. The trio had been nominated for the season finale “Whitecaps.”

Among variety/music/comedy specials, Emmy voters believed in Cher, whose NBC “Farewell Tour” special took the top award.

Glenn Weiss landed the directing in a variety/music/comedy special, for directing the 56th Annual Tony Awards.