The Prophet (pbuh) teaches Ali (ra) a Du’a for memory

 Abdullah  bin 'Abbas Radiyallahu Anhu narrated : “Once, when we were with the Prophet of Allah, (saws), 'Ali bin Abi Talib Radiyallahu Anhu came and said: "O prophet of Allah, to me you are like a father or mother. This Qur`an is slipping out of my chest so that it is becoming very hard to me to keep it in my memory." The Prophet (saws) responded: -Would you like me to teach you words (a supplication), which will, by the help of Allah, benefit you and those whom you teach? That way you will, by the help of Allah, make lasting in you chest (memory) what you memorized? Yes, teach me, o prophet of Allah – said 'Ali.

When the night of Friday starts (Lailatul- Jumu’ah), if you manage to get up in the last third of that night – get up, because that time is blessed and in it Allah accepts supplications. My brother Ya’qub told his sons: -“ I will surely supplicate to my Lord for you”; and he was intending to do that in the Jumu’ah night. If you can not get up in its last third, then try in its half. And if you do not manage even in that part, get up at the beginning of that night and offer 4 rak’ahs. During the first rak’ah read sura al-Fatihah and the sura Yasin, during the second read suras al-Fatihah and al-Dukhan, during the third rak’ah surahs al-Fatiha and al- Sajdah, and on qiyam of the fourth rak’ah read suras al-Fatihah and al-Mulk.

Upon completion of the fourth rak’ah, thank Allah and nicely express yourself about Him, then bring Salawat on me and do that nicely. Also, bring Salawat on other prophets of Allah and seek forgiveness for believing men and women and your brothers who surpassed you in religion. At the end, he said:

الَّلهُمَّ ارحمنِي بتركِ المعاصي أبداً ما أبقيتنِي، وارحمني أنْ أتكلَّفَ ما لا يعنيني،وارزُقني حُسنَ النَّظرِ فيما يُرضِيكَ عنِّي،الَّلهُمَّ بديعَ السَّماواتِ والأَرْضِ ذا الجلالِ والإكرامِ والعزَّةِ التي لا تُرامُ أسألُكَ يا اللَّهُ يا رحمنُ بجلالكَ ونورِ وجهكَ أنْ تُلزِمَ قلبي حِفظَ كِتابِكَ كما علَّمتني وارزُقني أنْ أتلوهُ على النَّحوِ الَّذي يُرضيكَ عنِّي الَّلهُمَّ بديعَ السَّماواتِ والأَرْضِ ذا الجَلالِ والإكرامِ والعِزَّةِ التي لا تُرامُ أسألكَ يا اللَّهُ يا رحمن بجلالكَ ونورِ وجهكَ أنْ تُنَوِّرَ بكتابِكَ بصري وأنْ تُطلِقَ بهِ لساني وأنْ تُفرِّجَ بهِ عَن قلبي وأنْ تشرحَ بهِ صدري وأنْ تغسلَ بهِ بدني فإنَّهُ لا يُعينُنِي على الحقِّ غيرُكَ ولا يُؤتيهِ إلاّ أنتَ ولا حولَ ولا قوَّةَ إلاّ باللَّهِ العليِّ العظيمِ.

“O Allah, have mercy on me so that I stay away from sinning for as long as I live! Have O Allah, the Creator of the heavens and the earth, the Glorious and Honorable and Almighty, I beg you, the most Merciful, calling upon Your Glory and the Light of Your Face, to oblige my heart to remember Your Book the way You taught me. Bless me to read it the way that will please You! My Lord, the Creator of the heavens and the earth, You Who are absolute in Your might, I implore You the most Merciful, calling upon Your Glory and Light of Your Face, to illuminate with you Qur`an my sight, to move with it my tongue and make it easy on my heart. With it make my chest wide and clean my body. Truly, on the path of Truth only You can help me and only You are able to give me the Truth. There is no might no power except with Allah, the most High, and the most Glorious!”

“O Abu al-Hasan, you will do that on three, five or seven Friday (Jumu’ah) nights, and it will be accepted from you with the permission of Allah. By the One Who sent me with the Truth this has not yet left unaffected any (true) Muslim!

Abdullah ibn 'Abbas narrates: “By Allah, not five or seven Fridays passed by and 'Ali again came to the prophet and said: -O Prophet of Allah, earlier I used to memorize four verses at once, and each time I wanted to repeat them they would disappear. Now I memorize more than forty verses, and when I repeat them I feel as if the Book of Allah is wide open in front of me. Also, when I now hear your sayings and pass them on later, I do not omit one letter from them.”

The prophet of Allah said on that occasion: “You are the believer, by the Lord of Ka’bah, o Abu al-Hasan! {Tirmidhi: Vol 2/Page 192}