Happened to me too, I solved by playing audio/video when I don't want to my laptop go to sleep.
Another way use auto click software like http://www.murgaa.com/auto-clicker-mac/
But I think the best solution is Jksoegaard's answer, just use the dedicated app to stay awake "Amphetamine". I am not tested it yet, but looks promising.