It is narrated from Sayyiduna Abu Sa'id al-Khudri (may Allah be pleased with him) that when the Messenger of Allah (peace and blessings be upon him) stood for prayer at night, he would recite this: "'Subhanaka Allahumma wa bihamdika, wa tabaraka ismuka, wa ta'ala jadduka, wa la ilaha ghayruk' (O Allah, You are free of all imperfection and You are with Your praises; Your name is blessed, Your majesty is exalted, and there is no god besides You)." Then he would recite three times: "'La ilaha illallah, la ilaha illallah, la ilaha illallah' (There is no true god except Allah)." Then he would say the takbir three times: "'Allahu akbar, Allahu akbar, Allahu akbar' (Allah is the Greatest)." Then: "'A'udhu billahi al-sami'i al-'alimi min al-shaytani al-rajimi min hamzihi wa nafthihi wa nafkhih' (I seek refuge with Allah Almighty, who is All-Hearing and All-Knowing, from Satan the accursed, and from his whispering, from the wind of arrogance and from the puffing of magic)." Ja'far said: By hamz is meant madness, fainting.
And by nafth is meant poetry and the like, and by nafkh is meant arrogance.
The Shaykh (may Allah have mercy on him) said that a hadith of Sayyiduna Ibn Mas'ud (may Allah be pleased with him) is also reported about beginning the prayer with 'Subhanaka Allahumma wa bihamdik'.
Abu Dawud said: About this hadith they say it is from Ali bin Ali, from al-Hasan, and the error is from Ja'far. The hadith of Ibn Mas'ud is not strong, and the most authentic report on this is the mawquf report from Umar bin al-Khattab (may Allah be pleased with him).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2349