He saw in a dream that he passed by a group of Jews and asked, "Who are you?"They replied, "We are the Jews."He said, "You would be an excellent people if only you did not claim that Uzayr is the son of Allah."The Jews replied, "And you would be an excellent people if only you did not say, 'Whatever Allah wills and Muhammad wills.'"Then he passed by a group of Christians and asked, "Who are you?"They replied, "We are the Christians."He said, "You would be an excellent people if only you did not say that the Messiah is the son of Allah."They replied, "And you would be an excellent people if only you did not say, 'Whatever Allah wills and whatever Muhammad wills.'"When morning came, he told some people about the dream, then went to the Prophet ﷺ and informed him.The Prophet ﷺ asked, "Have you told anyone about it?"Affan said, He replied, "Yes."When they had finished their prayer, the Prophet ﷺ addressed them. He praised Allah and extolled Him, then said, "Tufayl had a dream which he related to some of you. You have been saying a phrase that shyness before you prevented me from forbidding. Do not say, 'Whatever Allah wills and whatever Muhammad wills.'"
حدثنا بهز وعفان قالا ثنا حماد بن سلمة عن عبد الملك بن عمير عن ربعي بن حراش
أنه رأى فيما يرى النائم كأنه مر برهط من اليهود فقال من أنتم قالوا نحن اليهود قال إنكم أنتم القوم لولا أنكم تزعمون أن عزيرا ابن الله فقالت اليهود وأنتم القوم لولا أنكم تقولون ما شاء الله وشاء محمد ثم مر برهط من النصارى فقال من أنتم قالوا نحن النصارى فقال إنكم أنتم القوم لولا أنكم تقولون المسيح ابن الله قالوا وإنكم أنتم القوم لولا أنكم تقولون ما شاء الله وما شاء محمد فلما أصبح أخبر بها من أخبر ثم أتى النبي ﷺ فأخبره فقال هل أخبرت بها أحدا قال عفان قال نعم فلما صلوا خطبهم فحمد الله وأثنى عليه ثم قال إن طفيلا رأى رؤيا فأخبر بها من أخبر منكم وإنكم كنتم تقولون كلمة كان يمنعني الحياء منكم أن أنهاكم عنها قال لا تقولوا ما شاء الله وما شاء محمد
Its isnad is sahih, its narrators are trustworthy and well-known figures. The hadith was narrated by Ibn Majah 1/685, no. 2118, in the chapter on expiations, on the prohibition against saying "as Allah wills and as Muhammad wills." Also by Darimi 2/295, in the chapter on seeking permission, with similar wording. Also by Hakim 3/462-463, and Dhahabi said nothing about it. Also by Tabarani in Al-Kabir 8/324, no. 8214.