Memory is the faculty of the brain by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remembered, it would be impossible for language, relationships, or personal identity to develop.
There are many Du'as for increasing the memory e.g.
1. Repeating Salawaat (ALLAHUMMA SALLI 'ALA MUHAMMAD WA AALI MUHAMMAD) as it is mentioned in many Hadeeths.
2. Repeating (LA HAWAL WALA QOWWAT ELLA BILLAH) as it is narrated from Imam Musa AL-Kadhim (AS).
3. Reciting this Du'a after obligatory Prayers ( SUBHANA MANLANYA'TADI 'ALA AHLI MAMLAKATIH, SUBHANA MANLA YA'KHOTHU AHLAL ARDHI BI ALWAAN AL ATHAAB, SUBHANAL RA'OOF AL RAHEEM, ALLAHUMMA EJ'AL LI FI QALBI NOORAN WA BASARAN WA FAHMAN WA 'ELMAN INNAKA 'ALA KULLI SHAY'IN QADEER.
سبحان ٬من لا يعتدي على أهل مملكته
سبحان ٬من لا يأخذ أهل الأرض بألوان العذاب
سبحان الرؤوف الرحيم
اللهم اجعل لى في قلبي نورا وبصرا وفهما وعلما
إنك على كل شيء قدير
If you want a short Du'a for better memory, you can recite: ALLAHUMA EJ'AL LI FI QALBI NOORAN WA BASARAN WA FAHMAN WA 'ELMA INNAKA 'ALANKULLI SHAY'IN QADEER.
It is narrated that one of the first things that happens in the barzakh (the next realm after this life) is that a human being is forced to transcribe their entire life.
Also with respect to the hereafter it is said that all deeds will be clearly visible and known, and that all things are recorded (except for what Allah wills to hide or forgive).
So, basically, there is a complete memory there, including of things we have forgotten during our lives in this world.