Bismillahir Rahmaanir Raheem
Al Jawaab Billahit-Tawfeeq
Respected brother
Although it is more rewarding to perform Tahajjud after waking up from sleep, it can be prayed before sleeping as well.
It can be prayed anytime after Esha Salah until Fajr time starts, however, it is better to pray it during the later portion of the night. (See Fatawa Mahmudia, Page 349)