The best way to stay awake while working is to take a short break every now and then. The best way is to go for a walk or do something else.