This hadith has been transmitted on the authority of Mughira b. Shu'ba and the words are:
Allah's Apostle (ﷺ) kept standing in prayer (for such long hours) that his feet were swollen. They (his Companions) said: Verily, Allah has pardoned for you the earlier and the later of thine sins. Thereupon he said: Should I not prove myself to be a grateful servant (of Allah)?
Reference: Sahih Muslim 2819 b In-book : Book 52, Hadith 78 USC-MSA web (English) : Book 39, Hadith 6773 (deprecated)
Help us gift a modern, ad-free Islamic application for the Muslim Ummah. Your donation will be recorded as Sadaqah Jariyah in your book of deeds, In Sha Allah.