I can attest somewhat to the efficacy of the practice; in younger days I did it myself on occasion, and found it often to have the beneficial effect described upthread - as well as, on the day after the sleepless night, an interesting and generally useful upsurge of sidewise and creative thought that tended to produce ideas I could capture and usefully follow up on later, after the sleepful second night.
On the other hand, younger days being now behind me, I'm no longer able to miss a night's sleep and remain awake, much less productive, on the day following. So it goes.
Fresh air and light exercise help me during those last hours, but it can be mentally difficult to force myself to doing that.
Again, it's been a while since I've done it, so it may have been a symptom of being a bit younger. Maybe I wouldn't be able for it now...
I found switching activities every 45 minutes or so kept me sufficiently engaged.