From the last interview Larry Gelbart ever gave (to Vanity Fair's Mike Sacks):
When you're writing and come to a rough spot and the ideas just aren't flowing, put down dummy text and keep on moving—especially if it's at the end of the day and you're going to stop. Your brain will never stop for the day, even if you have stopped working, and there's a very good chance you'll come up with something better. Also, at the very least, you'll have something to come back to the next day, instead of a blank page. That's important.
But in general terms, just sit your ass down in a chair and hope your head gets the message. Isaac Bashevis Singer's advice for the struggling young writer was to stop struggling and write. As for me, I don't have any other advice. If I did, I would have had a far more trouble-free life and a much, much better career.