It was a practice of the Prophet, peace and blessings be upon him, to spend the last ten days and nights of Ramadan in the mosque for I`tikaf.
Sayyidatina Aisha, may Allah be pleased with her, said: I asked the Messenger of Allah: ‘O Messenger of Allah, if I know what night is the night of Qadr, what should I say during it?’ He said:
اَللَّهُمَّ اِنَّكَ عَفُوٌّ ، تُحِبُّ الْعَفْوَ فَاعْفُ عَنِّي
Allahumma innaka ‘affuwwun tuhibbul ‘afwa fa’fu ‘anni’ “
‘Say: O Allah, You are Oft-Pardoning and You love to pardon, so pardon me.'”
[Imam Ahmad, Imam Ibn Majah, and Imam at-Tirmidhi].
Abu Hurairah quoted Allah’s Messenger as saying: “Whoever stands (in prayer) in Laylatul Qadr while nourishing his faith with self-evaluation, expecting reward from Allah, will have all of his previous sins forgiven.”
[Sahih Imam al-Bukhari and Imam Muslim].