I have tried setting the energy saver setting sleep to never. I tried both Caffeine and NoSleep apps. I've tried setting pmset sleep to 0. I read somewhere that it might be the lid sensor which is on the ribbon cable for the battery light indicator, so I disconnected it but it would still go to sleep. I've also tried resetting the SMC, and it made no difference. Not sure what is wrong. I'm running 10.9.3 on a Macbook Pro mid 2009.
Update: http://pastebin.com/7Q3aVZam Power Management logs
pmset -g everything > ~/Desktop/pm.txt
to create a dump of power management logs and other useful power information. There are likely clues in there to help those answering this question.