One thing I've studied over the years is comedic timing, on television and on the stage. I know this doesn't have that much to do with the written page, but I think it helps if you understand that when you're writing comedy. None of my in-depth critiques have ever faulted the humor in CHOKE, and that makes me very happy!
The easiest kind of humor is mean. (Well, the very easiest is filthy potty-mouthed.) That's a kind I try to stay away from. There's a simple secret to keeping the humor away from ridicule and mocking. That's to love your characters. I do dearly love all my characters. I know some are odd balls (and at least one is a murderer), but there is something to like about each one. I give the reader reasons for their odd behaviors, which makes them more understandable. That is, after all, just part of knowing the characters—knowing why they act the way they do.