Okay, so its my first post and it's probably going to get me laughed at, but i believe, I have an as yet (relatively) undiscovered solution to your problem. You need to eat...Apples!!!
Yep thats right, in my experience it actually keeps you alert even more so than caffeine. While caffeine is somewhat of a quick hit hit that lasts for a short period of time, apples are somewhat different. Think of it as a sort of long term endurance. I usually eat one every couple of hours throughout the night, and its wonderful you can stay awake without the negative effects of caffeine and when you finally want to sleep you can do that too.
It definitely has an affect for me, whether it's some kind of real physiological change or just the mindset that what I'm doing is helping me i'm not sure. All i can say is try it for yourself and let me know how it goes, you have nothing to lose.