No matter what form of scripted television you enjoy (drama, comedy, or dramedy) there is always something I notice that helps keep a show stay on longer than three seasons - story archs.
The problem with running only one main mystery that spreads throughout the entire season is that it demands a lot of commitment for viewers. Realistically all networks want their audiences committed to their programs, but it should be done very subtly. What's worse, a mystery that stretches beyond just one seasons into several.
The solution, I think, is creating multiple story arches. Actually, creating many small ones that interconnect seasons and episodes. I look to HIMYM as a good example of this. Anyone can pop in any episode they want and enjoy 25 minutes of comedy, very little commitment. The same is true with Parks and Recreation, Happy Endings, The Office, Modern Family, etc. The reward for regular viewers is that they are privy to connected story arches. In a way they are inside jokes, if you are a regular viewer watching with a friend who is new to the show; the characters say or do something related to a previous episode/season that you would only get if you watched that previous episode/season.
Likewise, if a character makes mention of something that is coming up in future episodes or seasons, then when it occurs it makes you feel really good! Or is that just me?
Anyway, I've been in the watching tv business for most of my life (sadly) and I think this formula or method works really well. Otherwise you end up with a bait and switch; a cool mystery story arch but then all you get are useless scenes that are more confusing than the episodes before it (I'm looking at you. Heroes).