The Messenger of Allah ﷺ said, "Whoever fears he will not be able to rise in the last part of the night should perform the witr prayer at the beginning of the night, and whoever expects to rise at its end should perform witr at the end of the night, for the prayer at the end of the night is witnessed, and that is more excellent."In another narration, "Whichever of you fears he will not rise at the end of the night should perform witr and then sleep, and whoever is confident that he will rise at the end of the night should perform witr at its end, for the recitation at the end of the night is witnessed, and that is more excellent."
قال رسول الله ﷺ: من خاف أن لا يقوم من آخر الليل فليوتر أوله، ومن طمع أن يقوم آخره فليوتر آخر الليل، فإن صلاة آخر الليل مشهودة، وذلك أفضل. وفي رواية: أيكم خاف أن لا يقوم من آخر الليل فليوتر، ثم ليرقد، ومن وثق بقيام من الليل فليوتر من آخره. فإن قراءة آخر الليل محضورة، وذلك أفضل.
A version reads, "Whoever among you fears that he will not wake up during the latter part of the night should perform the witr prayer, then sleep. And whoever is confident he will wake up during the night should perform the witr prayer at its end, for recitation at the end of the night is attended, and that is more excellent."Muslim narrated this in the chapter on the prayer of the traveler (755), from Abu Bakr bin Abu Shayba, who said, Hafs and Abu Muawiya narrated to us, from Amash, from Abu Sufyan, from Jabir, who related it.The second version is also found in Muslim, through another route, from Abu Zubayr, from Jabir, who related it.