And the evidence that the Prophet, peace and blessings be upon him, commanded performing Witr before sleeping, as a means of precaution and firmness, out of fear that a person may not wake up at the end of the night to perform Witr then. And that he only commanded performing Witr at the end of the night for those who are able to stand in prayer at the end of the night, along with the evidence that performing Witr at the end of the night is better for those who are able to stand in prayer at the end of the night.
It is narrated from Sayyiduna Abu Qatadah (may Allah be pleased with him) that the Noble Prophet (peace and blessings be upon him) asked Sayyiduna Abu Bakr (may Allah be pleased with him), "When do you perform Witr?" He replied, "I perform Witr before sleeping." Then the Prophet (peace and blessings be upon him) asked Sayyiduna Umar (may Allah be pleased with him), "When do you perform Witr?" He replied, "I sleep first, then (after waking up) I perform Witr." So the Noble Prophet (peace and blessings be upon him) said to Sayyiduna Abu Bakr (may Allah be pleased with him), "You have chosen caution and firmness." And to Sayyiduna Umar (may Allah be pleased with him) he said, "You have chosen strength and determination." Imam Abu Bakr (may Allah have mercy on him) says that according to our companions, this narration is Mursal from the chain of Hammad; in it, the intermediary of Sayyiduna Abu Qatadah (may Allah be pleased with him) is not mentioned.
Hadith Referenceصحيح ابن خزيمه / جماع أبواب ذكر الوتر وما فيه من السنن / 1084