First of all, we’d like to state that Tahajjud Prayer is part of the Sunnah of the Prophet (peace and blessings of Allah be upon him) which Muslims should follow all the time; it’s not something confined to Ramadan.

Tahajjud may be performed in the early part of the night, the middle part of the night, or the latter part of the night, but after the obligatory salatul `Isha’ (Evening prayer). However, it is best to delay this prayer to the last third portion of the night. Abu Hurairah quoted that the Messenger of Allah, as saying: “Our Lord descends to the lowest heaven during the last third of the night, inquiring: ‘Who will call on Me so that I may respond to him? Who is asking something of Me so I may give it to him? Who is asking for My forgiveness so I may forgive him?”‘ This is related by the group.
`Amr ibn Abasah reported that he heard the Prophet (peace and blessings be upon him) saying: “The closest that a slave comes to his Lord is during the middle of the latter portion of the night. If you can be among those who remember Allah, the Exalted One, at that time then do so.”

In addition, if a muslim will not sleep at night, then they can perform Tahajjud Prayer any time before Fajr after performing `Ishaa’. However, it is best to delay it until the last third of the night as stated above. Sleeping before Tahajjud is not a condition for its validity.

Elaborating on this, Sheikh `Abdul-Majeed Subh, a prominent Azharite scholar, states: “There is nothing wrong in performing Tahajjud and Witr Prayer before sleeping or without sleeping and they are valid even if the Shafi`i scholars are of the opinion that one should sleep before offering Tahajjud. But this is some sort of ijtihad (personal reasoning) that does not prevent the validity of the Tahajjud and Witr Prayer performed by one before going to sleep. In this regard, we read in the hadith reported by Abu Ad-Dardaa’, ‘The Prophet (peace and blessings be upon him) recommended me to do three things (regularly): to fast three days every month, to perform Duha Prayer, and to perform Witr Prayer before I sleep.'”