Usually this is due to production cost, as stated earlier.
Also, quite a few shows are switching to the 40 minute length. It gives writers wider berth for more complicated stories (Shows like Boston Legal, Breaking Bad, and Burn Notice are impossible without such time slots), offers more in show commercial time then 18-22 minute shows (Because TV Execs know you aren't watching in between show commercials), and increases the odds people will stick on the channel for longer periods of time (because netting a crowd for an hour, guaranteed, because they like a show, is better then betting said crowd will like a 20 minute show and then stick around for filler just because).
Also, as said before, its kind of a testing method. Breaking Bad and Castle, for example, had dreadfully short first seasons. But it let execs test things they normally wouldn't bet on (Like having Malcom's dad sell meth, and see if people would swallow it [And oh God, did I], or letting Nathan Fillion have another shot at TV stardom [hell yes.]).