Ubada reported that the Prophet ﷺ said, "The merit of knowledge is dearer to me than the merit of worship, and the best of your religion is godly restraint."
عن النبي ﷺ قال: فضل العلم أحب إلي من فضل العبادة، وخير دينكم الورع.
No references are available.
Hakim narrated it (1/92) via Khalid bin Mukhlad, from Hamza Zayyat, from Amash, from Hakam, from Musab bin Saad, from his father, and he mentioned the hadith. Bayhaqi narrated it from him in Madkhal (454).Hakim said, "Hasan bin Ali is trustworthy, and he established the chain clearly, while Bakr bin Bakkar left it ambiguous, saying, 'Hamza Zayyat narrated to us, Amash narrated to us from a man, instead of Hakam, from Musab,' and he mentioned it." Then he said, "We then examined the matter and found that Khalid bin Mukhlad is more reliable, more retentive, and more trustworthy than Bakr bin Bakkar, so we ruled in favor of his addition."He also said it is sahih according to the criteria of the two Shaykhs, though they did not narrate it. But this is not as he said, for Bukhari did not narrate from Hamza Zayyat.Its chain is hasan because of Khalid bin Mukhlad Qatawani, about whom there is disagreement. Ibn Main said, "There is no harm in him," while Ahmad, Ibn Saad, and others criticized him. Likewise, it contains Hamza, who is Ibn Habib Zayyat, and his hadith is hasan.