Sunan an-Nasa'i, Book 20, Hadith 98 (Nasa'i 1700)

It was narrated from Ibn 'Umar that:

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."