It is narrated from Abdullah bin Umar (may Allah be pleased with them both) who states: I heard the Messenger of Allah (ﷺ) saying: "The night prayer is in sets of two rak‘ahs. Then when one fears that dawn is approaching, he should pray one rak‘ah as witr."
Hadith Referenceمسند الإمام الشافعي / كتاب الصلاة / 387
Hadith Takhrijاخرجه ابن ماجة اقامة الصلوات، باب ما جاء فى صلاة الليل ركعتين (1320) واحمد: 2/9 - وصححه ابن خزيمة (1072) وابن الجارود (267)۔