Arrested Development is some of the most brilliant TV I've ever seen. Cancelled before it's time.
Community is really good too.
Red Dwarf
Monty Python
Fawlty Towers
The Young Ones
Blackadder
Spaced
The Fall and Rise of Reginald Perin
Goodness Gracious Me
The League of Gentlemen
Teachers
Chamakh > Friends
Für eure Sicherheit
Seconded, I was genuinely surprised with how funny Community was, still possibly only the second funniest of current shows behind Modern Family though and AD is simply awesome.
Coupling would probably come down as my favourite though, that along with Dr Who and Sherlock proves that Stephen Moffat is simply brilliant.
Still streets behind Modern Family until it gets an over-proportioned Colombian.
Curb Your Enthusiasm is one of the best things in the last decade or so.
As is The Thick Of It in terms of British comedy.
Of all time?
The Simpsons at it's best is incredible in that it brings together so many types of comedy and hits you with ingenious ideas constantly in the space of twenty minutes.
Futurama was/is superb too, but I haven't seen the more recent ones.
Blackadder, Fawlty Towers and Keeping Up Appearances are differing but equally good examples of British comedy and it's various charms. Monty Python's Flying Circus too of course.
In terms of American comedy, I think they excel most at the simple familial sitcoms like Fresh Prince, Cheers and yes, even Friends. They may not be overly sophisticated, but they do what they do very effectively and execute it much better than most British sitcoms. Frasier would be the most high-class example of this.
More recently, shows like My Name Is Earl and 30 Rock have that Simpsons-esque sense of the surreal under a seemingly traditional format.
I agree that Frasier is well written and that some of the early Friends had some decent scripts, but the problem is that when you get to series 47 episode 573, then you get the feeling you've already seen it. As for the Friends audiences, jeez. That really is sad girly stuff and is vomitworthy.