The Prophet ﷺ said, "Allah says, 'I am as My servant thinks of Me, and I am with him when he calls upon Me.'"
أن النبي ﷺ قال: يقول الله: أنا عند ظن عبدي به، وأنا معه إذا دعاني.
Ahmad (13192) and Abu Yaala (3232) both narrated it from the hadith of Abu Dawud Sulayman (that is, Tayalisi), who said, "Shuba narrated to us, Qatada narrated to us, from Anas bin Malik," and he related it. Its chain of transmission is sahih.