Accordingly, the man returned home and followed the instruction of Imaam Abu Hanifah (rahimahullah), and after performing salaah for just one quarter of the night, he remembered where he had buried the wealth.
The following day, the man came to Imaam Abu Hanifah (rahimahullah) and informed him of what had transpired. Imaam Abu Hanifah (rahimahullah) replied, “I knew that shaitaan would not leave you to perform salaah the entire night. Hence, he would remind you as to where you had buried your wealth so that you would cease performing salaah. How nice it would have been if you had shown gratitude to Allah Ta‘ala by continuing to perform salaah for the remainder of the night.”
(Tabyeedh-us-Saheefah pg. 137)