Sahih al-Bukhari 2311 · before sleep
Abu Hurayrah and the Thief: The Ayatul Kursi Story in Full
By Zakir Mohammed · updated 6 November 2026 · 9 min read
Most people first hear about reciting Ayatul Kursi before sleep as a one-line tip: read it at night and you are protected until morning. The tip is true, but it comes from a story, and the story is better than the tip. It has a hungry thief, a companion who keeps letting him go, three nights of the same scene, and a twist at the end that the Prophet ﷺ explains himself. It is also one of the few places where we learn a piece of the religion from the mouth of a devil, and then hear the Prophet ﷺ confirm it.
This article goes through the narration night by night, as al-Bukhari records it, and then looks at what it actually promises, what it does not, and how people put it into practice today.
Where the story is recorded
The full narration is in Sahih al-Bukhari 2311, in the Book of Agency (Kitab al-Wakalah). Al-Bukhari placed it there because Abu Hurayrah had been put in charge of something that was not his: the zakat al-fitr collected at the end of Ramadan. The same event is referred to again in Sahih al-Bukhari 3275 and 5010. Because it is in al-Bukhari, its authenticity is not in question, and scholars of every school quote it when they discuss the adhkar of sleep.
Abu Hurayrah said: “The Messenger of Allah ﷺ put me in charge of guarding the zakat of Ramadan. Someone came to me and began scooping up the food, so I seized him and said: I will take you to the Messenger of Allah ﷺ.”
Sahih al-Bukhari 2311
The first night
Picture the setting. The zakat al-fitr was paid in food: dates, barley, raisins, dried cheese. It was gathered in Madinah in the last days of Ramadan and kept until it was handed out to the poor. Abu Hurayrah, who was himself one of the poorest of the companions, was told to watch over it.
A man came in the night and started taking handfuls. Abu Hurayrah caught him and threatened to bring him to the Prophet ﷺ. The man pleaded: he was in need, he had a family, he was in real hardship. Abu Hurayrah, who knew hunger from the inside, let him go.
In the morning the Prophet ﷺ asked him, before he had said a word: “Abu Hurayrah, what did your captive do last night?” Abu Hurayrah explained that the man had complained of great need and a family, so he had pitied him and released him. The Prophet ﷺ said: “He lied to you, and he will come back.”
The second night
Because the Prophet ﷺ had said he would return, Abu Hurayrah waited for him. The man came and began scooping up the food again. Abu Hurayrah seized him and once more said he would take him to the Messenger of Allah ﷺ. Once more the man begged: let me go, I am in need, I have children, I will not come back. And once more Abu Hurayrah let him go out of pity.
The morning conversation repeated itself almost word for word. “What did your captive do?” “He complained of need and a family, so I let him go.” “He lied to you, and he will come back.”
It is worth pausing on Abu Hurayrah here. He is not careless. He catches the thief every single time. What defeats him is mercy. The thief knows exactly which door to knock on: the door of a man who had tied stones to his own stomach from hunger.
The third night and the bargain
On the third night Abu Hurayrah caught him again and this time refused to be moved. “This is the third time,” he said, “and each time you claim you will not return, and then you return. I am taking you to the Messenger of Allah ﷺ.”
So the thief changed his approach. He no longer asked for pity. He offered a trade:
“Let me go and I will teach you words by which Allah will benefit you.” I said: What are they? He said: “When you go to your bed, recite Ayat al-Kursi, اللَّهُ لَا إِلَٰهَ إِلَّا هُوَ الْحَيُّ الْقَيُّومُ, until you finish the verse. Then there will remain over you a guardian from Allah, and no devil will come near you until morning.”
Sahih al-Bukhari 2311
Abu Hurayrah let him go. In the narration he explains why: the companions were very keen on anything good. A sentence that promised protection for the whole night was worth more to him than one man’s punishment.
The twist: “He told you the truth, though he is a liar”
In the morning the Prophet ﷺ asked the same question, and Abu Hurayrah told him about the words he had been taught. The reply is the line that everyone remembers:
“He told you the truth, though he is a great liar. Do you know who you have been speaking to for three nights, Abu Hurayrah?” He said: No. He said: “That was a shaytan.”
Sahih al-Bukhari 2311
Two things happen in that reply. First, the Prophet ﷺ confirms the content. The protection of Ayatul Kursi at night is not a claim we take from a devil; it is a claim the Prophet ﷺ verified and passed on. Second, he names the visitor. The “poor man with children” was never poor and never had children. His pleading on the first two nights was a lie, which is why the Prophet ﷺ said “he lied to you” each morning, and on the third night he told the truth only because it bought his freedom.
The key point: the benefit comes from the Prophet’s ﷺ confirmation, not from the devil. Scholars note that if a liar happens to say something true, we accept the true thing because of the evidence for it, not because of the speaker.
What the hadith promises, exactly
It is easy to stretch this narration into things it does not say, so it helps to list what it does say:
- When: “when you go to your bed”, meaning at the time of lying down to sleep. Scholars include a daytime nap under the same wording, since it is still going to bed.
- What: the whole verse, “until you finish it”. Not the first line only.
- The result: a guardian (hafiz) from Allah stays with you, and no devil comes near you until morning.
- How many times: once. There is no number in the hadith.
Things it does not say: that the house is protected for a year, that 313 recitations do something special, that it must be read three times, or that it replaces the other bedtime adhkar. Those additions circulate widely, and we cover several of them in weak hadith about Ayatul Kursi.
Lessons people often miss
A devil can recognise what harms him
The visitor knew precisely which verse would keep his kind away. That tells us something about the verse itself. Ayatul Kursi is pure tawhid: it describes Allah as the Ever-Living who never sleeps, the Owner of everything, the One whose knowledge surrounds all things. A devil’s work depends on whispering and false fear, and this verse leaves no room for either. For why this verse in particular carries that weight, see why Ayatul Kursi is the greatest verse.
The Prophet ﷺ already knew
Each morning the Prophet ﷺ asked about “your captive” before Abu Hurayrah had reported anything. Commentators such as Ibn Hajar, in Fath al-Bari, point out that this was knowledge given to him by Allah. It also shows his method as a teacher: he let Abu Hurayrah learn through the experience instead of simply telling him on the first day who the visitor was.
Mercy is good, but it can be used against you
Abu Hurayrah’s softness was a virtue, and the Prophet ﷺ never rebuked him for it. But the story also shows how a deceiver works: through the very qualities you are proud of. That is a useful thing to remember about whispering in general. It rarely arrives looking like evil.
Trusts matter
Al-Bukhari’s chapter heading is about agency and trusts. The food belonged to the poor of Madinah. Abu Hurayrah’s job was to protect it, and the story is, among other things, a lesson in how seriously a trust should be taken.
How to practise it tonight
The practice is simple, which is part of its beauty:
- When you lie down, recite Ayatul Kursi once, completely, from Allahu la ilaha illa huwa to wa huwal-‘aliyyul-‘azim.
- Many people also recite al-Ikhlas, al-Falaq and an-Nas, blow into their cupped hands and wipe over the body, as the Prophet ﷺ did every night (Sahih al-Bukhari 5017). The two practices sit together well; we explain the order in Ayatul Kursi and the 3 Quls.
- Recite it with attention. You do not need to be in wudu to recite from memory, although sleeping in wudu is itself a sunnah (Sahih al-Bukhari 247).
If you have not memorised it yet, reading it from a phone or a printed card counts. Our line-by-line practice tool breaks it into ten short phrases, and the printable PDF fits on a bedside card.
A small habit that helps: tie it to something you already do every night, like plugging in your phone or switching off the light. Recite the verse at that moment, every time. After a couple of weeks it stops being something you remember and becomes something you do.
Questions readers ask about this hadith
Was the thief a man or a jinn?
The Prophet ﷺ called him a shaytan, a devil. Scholars explain that devils from among the jinn can take visible forms, and here he appeared as a needy man. Some later retellings add details about his appearance; those are not in al-Bukhari’s narration.
Does it work if I fall asleep before finishing?
The wording is “until you finish the verse”. Try to recite it at the start of lying down, while you are still alert, rather than leaving it for the moment you are drifting off.
Does it protect the whole family or only me?
The hadith speaks about the person who recites it. Parents often recite it over young children, or teach them to say it themselves. Teaching them is the better long-term gift; our 30-day plan for children is built around exactly that.
Is there a similar promise for the morning?
A narration in al-Hakim and at-Tabarani from Ubayy ibn Ka’b describes a similar encounter with a jinn and mentions protection when Ayatul Kursi is recited in the morning and evening. Some scholars graded it acceptable and others weaker than the Bukhari narration. The bedtime practice rests on the stronger evidence. See the graded hadith list for the details of each chain.
Why this story stays with people
It would have been enough for the religion to give us a short instruction: recite this verse before sleep. Instead we received three nights of a story, with a weak moment repeated twice, a turn on the third night, and a teacher who already knew how it would end. The lesson lands because we recognise ourselves in Abu Hurayrah. We also get caught by the same pleading voice, and we also need something to say before we close our eyes.
The verse he was taught is fifty words long. It takes under a minute. And in the Prophet’s ﷺ own confirmation, it leaves a guardian from Allah beside you until the morning.
Continue reading
Written by Zakir Mohammed
Every hadith is quoted with its collection and number, and graded as the scholars named beside it. Corrections are welcome: contact us.