Reference : Hisn al-Muslim 62

اللّهُـمَّ بِعِلْـمِكَ الغَـيْبِ وَقُـدْرَتِـكَ عَلـى الْخَلقِ 
أَحْـيِني ما عَلِـمْتَ الحـياةَ خَـيْراً لـي،
وَتَوَفَّـني إِذا عَلِـمْتَ الوَفـاةَ خَـيْراً لـي،
اللّهُـمَّ إِنِّـي أَسْـأَلُـكَ خَشْيَتَـكَ في الغَـيْبِ وَالشَّهـادَةِ، 
وَأَسْـأَلُـكَ كَلِمَـةَ الحَـقِّ في الرِّضـا وَالغَضَـب، 
وَأَسْـأَلُـكَ القَصْدَ في الغِنـى وَالفَقْـر،
أَسْـأَلُـكَ نَعـيماً لا يَنْفَـد، 
وَأَسْـأَلُـكَ قُـرَّةَ عَيْـنٍ لا تَنْـقَطِعْ 
وَأَسْـأَلُـكَ الرِّضـا بَعْـدَ القَضـاء، 
وَأَسْـأَلُـكَ بًـرْدَ الْعَـيْشِ بَعْـدَ الْمَـوْت، 
وَأَسْـأَلُـكَ لَـذَّةَ النَّظَـرِ إِلـى وَجْـهِكَ 
وَالشَّـوْقَ إِلـى لِقـائِـك، 
في غَـيرِ ضَـرّاءَ مُضِـرَّة، وَلا فِتْـنَةٍ مُضـلَّة، 
اللّهُـمَّ زَيِّـنّا بِزينَـةِ الإيـمان، 
وَاجْـعَلنا هُـداةً مُهْـتَدين
Allāhumma bi `ilmika ‘l-ghayb, wa qudratika `ala ‘l-khalq,
aḥyinī mā `alimta ‘l-ḥayāta khayran lī,
wa tawaffanī idhā  `alimta ‘l-wafāta khayran lī, 
Allāhumma innī as'aluka khash’yataka fil-ghaybi wash-shahādah, 
wa as'aluka kalimata ‘l-ḥaqqi fir-riḍā wa ‘l-ghaḍab, 
wa as'aluka ‘l-qaṣda fil-ghinā wa ‘l-faqr,
wa as'aluka na`īman lā yanfad, 
wa as'aluka qurrata `aynin lā tanqati`, 
wa as'alukar-riḍā ba`dal-qaḍā', 
wa as'aluka barda ‘l-`ayshi ba`da ‘l-mawt, 
wa as'aluka ladh-dhatan-naẓari ilā wajhik,
wash-shawqa ilā liqā'ik, 
fī ghayri ḍarrā'a muḍirrah, wa lā fitnatin muḍillah,
Allāhumma zayyinnā bi zīnati ‘l-'īmān,
waj`alnā hudātan muhtadīn.

O Allah, by Your Knowledge of the unseen and by Your Power over creation, 
let me live if You know that life is good for me, 
and let me die if You know that death is good for me. 
O Allah, I ask You to grant me fear of You in private and in public. 
I ask you for the word of truth in times of contentment and anger. 
I ask You for moderation in wealth and in poverty. 
I ask you for blessings never ceasing and the coolness of my eye (i.e. pleasure) that never ends. 
I ask You for pleasure after Your Judgment
and I ask You for a life of coolness after death. 
I ask You for the delight of gazing upon Your Face,
and the joy of meeting You, 
without any harm and misleading trials befalling me.
O Allah, dress us with the beauty of Faith
and make us guides who are upon (correct) guidance.

Reference:
An-Nasa'i 3/54, 55, Ahmad 4/364. See also Al-Albani, Sahih An-Nasa'i 1/281.

Chapter: After the last tashahhud and before salam