It was narrated from Jabir that the Messenger of Allah (ﷺ) said:
“Whoever among you fears that he will not wake up at the end of the night, let him pray Witr at the beginning of the night, then go to sleep. Whoever hopes that he will wake up at the end of the night, let him pray Witr at the end of the night, for recitation (of the Qur’an) at the end of the night is attended (by the angels), and that is better.”