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