It is reported that some of the scholars used to discuss hadeeth until the sun came up. Some of the sincere da’iyahs (callers, Islamic workers) still stay up at night discussing matters that keep those who care about the ummah awake. This kind of staying up is entirely worthy, so long as it does not lead to the neglect of something more important or more obligatory. Some people may stay up for a legitimate purpose, then miss fajr prayers. This is a mistake.
(2) Staying up for a permissible reason. This is fine, as long as it does not lead to the neglect of something obligatory. This includes, for example, travellers staying up to talk to one another, in order to relieve the tedium of travel. The Prophet (peace and blessings of Allaah be upon him) would stay up to talk to one of his wives and keep her company, when they were on a journey.
This also includes talking to one’s guests and keeping them company.
Also included is the staying up involved in modern-day shift work, created by the demands of materialistic circumstances. No doubt some of the interests of the Muslims demand the work of people at night, such as those who work in the security forces, in hospitals and airports, in supplying electricity, and so on.
(3) Staying up to commit sin, such as staying up to watch movies, to play haraam games