The Prophet ﷺ said, "Leave me with what I have left for you. Those who came before you were destroyed only because of their excessive questioning and their disagreements with their prophets. So when I forbid you from something, avoid it, and when I command you to do something, do as much of it as you are able."
عن النبي ﷺ قال: دعوني ما تركتكم، إنما هلك من كان قبلكم بسؤالهم واختلافهم على أنبيائهم، فإذا نهيتكم عن شيء فاجتنبوه، وإذا أمرتكم بأمر فائتوا منه ما استطعتم.
Bukhari related it in the Book of Holding Fast to the Book and the Sunnah (7288), and Muslim in the Book of Virtues (1337:131), both of them via Abu Zinad, from Aaraj, from Abu Hurairah, who mentioned it. The wording given is that of Bukhari, and the wording of Muslim is similar.