Answered by Sayyidi Habib Umar bin Hafiz (may Allah protect him and benefit us by him)
How do I improve my memory and become less forgetful?
You do this by consuming halal food, focusing your mind on what you are memorising, and not allowing it to wander.
Recite the following verse 7 times morning and evening:
سَنُقْرِئُكَ فَلَا تَنسٰىٓ
Sanuqri’uka fa lā tansā
We shall teach you [the Quran] and you will not forget (87:6)
Also recite the following salat in abundance between maghrib and isha:
اللَّهُمَّ صَلِّ و سَلِّمْ و بارِكْ على سَيِّدِنا مُحَمَّدٍ و على آلِهِ كما لا نِهَايَةَ لِكَمالِكَ و عَدَدَ كَمَالِهِ
Allāhumma salli wa sallim wa bārik ‘alā Sayyidinā Muhammad wa ‘alā ālihi kamā lā nihāyata li kamālika wa ‘adada kamālih
O Allah, bestow Your prayers, peace and blessings upon our Master Muhammad and his Family to the degree of Your limitless perfection and to the amount of his perfection.
What can be recited to help retain knowledge?
Recite these names of Allah 100 times each:
يا مُبْدِيءُ يا خَالِق
Ya Mubdi’ ya Khaliq
O Initiator, O Creator