He heard the Messenger of Allah ﷺ say: "Prayer at night is two rak'ahs by two rak'ahs, then when you fear tat dawn will break, pray witr with one rak'ah."
عَنْ رَسُولِ اللَّهِ ﷺ أَنَّهُ سَمِعَهُ يَقُولُ صَلاَةُ اللَّيْلِ رَكْعَتَيْنِ رَكْعَتَيْنِ فَإِذَا خِفْتُمُ الصُّبْحَ فَأَوْتِرُوا بِوَاحِدَةٍ