The Prophet ﷺ said, "Allah wrote a book two thousand years before He created the heavens and the earth, and from it He sent down two verses with which He concluded Surah al-Baqarah. They are not recited in any house for three nights without a devil being kept far from it."
عن النبي ﷺ قال: إن الله كتب كتابا قبل أن يخلق السموات والأرض بألفي عام، وأنزل منه آيتين ختم بهما سورة البقرة، ولا يقرآن في دار ثلاث ليال فيقربها شيطان.
Tirmidhi (2882) narrated it from Muhammad bin Bashshar, who said, "Abdul-Rahman bin Mahdi narrated to us, Hammad bin Salama narrated to us, from Ashath bin Abdul-Rahman Jarmi, from Abu Qilaba, from Abu Ashath Jarmi, from Numan bin Bashir," and he related it.Ibn Hibban (782) and Hakim (1/562, 2/260) both declared it sahih, both through the route of Hammad bin Salama, with his chain of transmission in a similar wording, except that Ibn Hibban did not mention the writing of the decrees two thousand years before the creation of the heavens and the earth. Hakim said in the first place, "Sahih in isnad." Tirmidhi said, "Hasan gharib."I say, it is as he said, for its isnad is hasan on account of Ashath bin Abdul-Rahman Jarmi, since his hadith is hasan. There is discussion about this hadith that was mentioned earlier regarding predestination.