Caffeine was a must have utility on OS X and features on my OS X 2012 list. Its a freeware and its awesome. It just sits on your menu bar with a coffee mug. Click to turn on and off. It does the job for me. Almost. Mostly.
There were times I forget to turn it either back on or off. But I overlooked this drawback, most of time. It used to be on at night, or at work when I am busy with something else. So I began searching for other apps, knowing I won’t get any better app. The hunt ended with Should I sleep! Its paid, but its worth it. Link to Mac App Store.