Praise be to Allah.
We cannot be sure about which du‘aa’ the questioner is referring to, but it seems most likely that what is meant is the words, “O jinn, I adjure you by the covenant that Sulaymaan ibn Daawood made with you, not to appear to us or harm us.”
These words are well known to many people as something that is to be said in such situations.
This was narrated in a da‘eef (weak) hadith that is not saheeh (sound).
It was narrated by Abu Daawood in his Sunan (5260), at-Tirmidhi in his Sunan (1485), an-Nasaa’i in ‘Amal al-Yawm wa’l-Laylah (968), Ibn Abi Shaybah in his Musannaf (19914), at-Tabaraani in al-Mu‘jam al-Kabeer (7/97), al-Bayhaqi in al-Aadaab (364), all via Ibn Abi Layla, from Thaabit al-Bunaani, from ‘Abd ar-Rahmaan ibn Abi Layla, from his father, that the Messenger of Allah (blessings and peace of Allah be upon him) was asked about snakes that live in houses. He said: “If you see any of them in your houses, say: I adjure you by the covenant that Nooh made with you, and I adjure you by the covenant that Sulaymaan made with you, not to harm us. Then if they come back, kill them.”
Its isnad is da‘eef, because it includes Muhammad ibn ‘Abd ar-Rahmaan ibn Abi Layla, who had a poor memory. Imam Ahmad said: He had a poor memory and his hadith is mudtarib (problematic). The fiqh of Ibn Abi Layla is preferable to his hadith in our view, because his hadith is mudtarib. Ibn Ma‘een said: He is not that good. End quote from al-Jarh wa’t-Ta‘deel (7/323). Ibn Hibbaan said in al-Majrooheen (2/244): He was bad at memorising, often got confused, and made many mistakes. He would narrate something of which he was not sure, therefore he narrated many odd (munkar) reports, and he deserves to be ignored. His hadith were ignored by Ahmad ibn Hanbal and Yahyaa ibn Ma‘een. End quote.
The hadith was also classed as da‘eef by al-Albaani in as-Silsilah ad-Da‘eefah (1508).
We have no need of that (du‘aa’), because we have what is proven in the saheeh hadiths of adhkaar which, if recited, Allah will protect the one who recites them from the evil of all evildoers. These include the following:
- When a Muslim goes to any place, he should say “A’oodhu bi kalimaat Allaah il-tammaati min sharri ma khalaqa (I seek refuge in the perfect words of Allah from the evil of that which He has created).”
The hadith concerning that was narrated by Muslim in his Saheeh (2708) from the hadith of Khawlah bint Hakeem as-Sulamiyyah. She said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “Whoever stops at a place and says: I seek refuge in the perfect words of Allah from the evil of that which He has created, nothing will harm him until he moves on from that place.”
- The Muslim should say every morning and evening: “B ismillah illadhi la yadurru ma’a ismihi shay’un fi’l-ard wa la fi’l-sama’ wa huwa al-samee’ ul-‘aleem (In the name of Allah with Whose name nothing can harm on earth or in heaven, and He is the All-Hearing, All-Knowing)” three times.
The hadith concerning that was narrated by at-Tirmidhi in his Sunan (3388) from the hadith of ‘Uthmaan ibn ‘Affaan, who said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “There is no one who says in the morning of every day and the evening of every night, ‘Bismillah illadhi la yadurru ma’a ismihi shay’un fi’l-ard wa la fi’l-sama’ wa huwa al-samee’ ul-‘aleem (In the name of Allah with Whose name nothing can harm on earth or in heaven, and He is the All-Hearing, All-Knowing)’ three times, but he will not be harmed by anything.”
The hadith is saheeh; it was classed as saheeh by Shaykh al-Albaani in Saheeh at-Tirmidhi (2698).
- Reciting Soorat al-Ikhlaas and al-Mu‘awwidhatayn [i.e., the last three soorahs of the Qur’an] three times, morning and evening.
The hadith was narrated by Abu Daawood in his Sunan (5082) from the hadith of ‘Abdullah ibn Khubayb, who said: We went out on a rainy and very dark night, looking for the Messenger of Allah (blessings and peace of Allah be upon him) to lead us in prayer, and we found him. He said: “Say,” but I did not say anything. Then he said: “Say,” but I did not say anything. Then he said: “Say,” and I said: What should I say, O Messenger of Allah? He said: “Say: Qul huwa Allaahu Ahad and al-Mu’awwidhatayn, in the evening and in the morning, three times, and they will suffice you against all things.
The hadith is hasan; it was classed as hasan by Shaykh al-Albaani in Saheeh at-Tirmidhi (2829).
- Reciting Aayat al-Kursiy before going to sleep.
The hadith concerning that was narrated by al-Bukhaari in his Saheeh (2311). It is the well-known hadith of Abu Hurayrah (may Allah be pleased with him), in which he spoke to a devil. Abu Hurayrah was guarding some food that had been given in charity and someone – who turned out to be a devil, as the Prophet (blessings and peace of Allah be upon him) informed Abu Hurayrah later on – repeatedly tried to steal some of the food, but was stopped by Abu Hurayrah and promised not to come back again, although he broke his promise thee times. On the third occasion, he told Abu Hurayrah: When you go to your bed, recite Aayat al-Kursiy, “Allah - there is no deity except Him, the Ever-Living, the Sustainer of [all] existence…” [al-Baarah 2:255], to the end of the verse. Then you will continue to have a protector from Allah, and no devil will come near you until morning comes.
When reciting these adhkaar, the Muslim should put his trust in Allah, may He be glorified and exalted, for whoever puts his trust in Him, He will suffice him, for He is the Protector, the All-Knowing.