The Quraysh said to the Messenger of Allah ﷺ, "We are not willing to be followers of these people, so drive them away from you." Something of that entered the heart of the Messenger of Allah ﷺ as Allah willed it to enter, so Allah revealed, "And do not drive away those who call upon their Lord morning and evening, seeking His face" [Anam 6:52], the verse.
حدثنا يحيى بن حكيم حدثنا أبو داود حدثنا قيس بن الربيع عن المقدام بن شريح عن أبيه عن سعد قال نزلت هذه الآية فينا ستة في وفي
قالت قريش لرسول الله ﷺ إنا لا نرضى أن نكون أتباعا لهم فاطردهم عنك قال فدخل قلب رسول الله ﷺ من ذلك ما شاء الله أن يدخل فأنزل الله عز وجل {ولا تطرد الذين يدعون ربهم بالغداة والعشي يريدون وجهه} الآية
No references are available.
Muslim narrated it in "The Virtues of the Companions," chapter on the virtue of Saad bin Abu Waqqas , hadith no. 45, 46/2413, through two paths from Miqdam.