If you know you will need to stay awake for a long period, make sure to get plenty of rest beforehand. The best plan is to sleep very well the night before, but even a short nap before having to stay awake can help. If you are staying up so that you can work at a computer or other in another situation where you concentrate on something for long periods, make sure to give your eyes a break. Every twenty minutes or so, set aside a minute to look away from the screen to rest your eyes. This helps you retain your focus and resist fatigue. A brief nap can actually increase your energy and alertness when you are trying to stay awake. However, you should only nap for 5-25 minutes, and you should not take more than one nap a day.  Make sure to set an alarm clock—or several—so that you will wake up from your nap. You may also feel groggy when you first wake up from your nap, so give yourself some time to get back to normal. If you can’t fall asleep, even closing your eyes and resting for 10 minutes can reinvigorate you. Even if you plan well ahead of time, staying awake for 24 hours or more will leave you feeling very fatigued. However, some research shows that you can make up for a lack of sleep by sleeping more afterwards. The day or night after you stay awake for a long period, give yourself the opportunity to sleep longer than usual. Most adults need 7-8 hours of sleep a night.

TL;DR in Indonesian:
Rencanakan program begadang Anda. Istirahatkan mata Anda. Cobalah untuk tidur siang. Setelah selesai begadang, beristirahatlah untuk mengganti waktu tidur yang kurang.