The Messenger of Allah ﷺ said, "Strive for moderation and aim for what is right, for none of you will be saved by his deeds."They asked, "Not even you, Messenger of Allah?"He replied, "Not even me, unless Allah envelops me in His mercy."
قال رسول الله ﷺ قاربوا، وسددوا، فإنه ليس أحد منكم ينجيه عمله قالوا: ولا إياك يا رسول الله؟ قال: ولا إياي، إلا أن يتغمدني الله برحمته.
Muslim narrated it in the chapter on the description of the Resurrection, Paradise, and Hell (2817), and Ahmad (14628), both via Sulayman Amash, from Abu Sufyan, from Jabir, who mentioned it. The wording is Ahmad's, for Muslim did not give the full wording but instead referred back to the hadith of Abu Hurairah before it.