Rarely would the Messenger of Allah ﷺ rise from a gathering without supplicating these words for his companions, "O Allah, apportion for us such fear of You as will come between us and disobedience to You, and such obedience to You as will bring us to Your Paradise, and such certainty as will make the calamities of this world easy for us to bear. Let us enjoy our hearing, our sight, and our strength for as long as You keep us alive, and make this enjoyment the inheritor from us. Place our retribution upon those who wrong us, and grant us victory over those who show enmity toward us. Do not make our affliction touch our religion, do not make this world our greatest concern nor the limit of our knowledge, and do not place over us those who will show us no mercy."
قلما كان رسول الله ﷺ يقوم من مجلس حتى يدعو بهؤلاء الدعوات لأصحابه: اللهم اقسم لنا من خشيتك ما يحول بيننا وبين معاصيك، ومن طاعتك ما تبلغنا به جنتك، ومن اليقين ما تهون به علينا مصيبات الدنيا، ومتعنا بأسماعنا وأبصارنا وقوتنا ما أحييتنا، واجعله الوارث منا، واجعل ثأرنا على من ظلمنا، وانصرنا على من عادانا، ولا تجعل مصيبتنا في ديننا، ولا تجعل الدنيا أكبر همنا ولا مبلغ علمنا، ولا تسلط علينا من لا يرحمنا.
It was narrated by Tirmidhi (3502) and Nasai in Amal al-Yawm wal-Layla (402), both through the route of Yahya bin Ayub, from Ubaydullah bin Zahr, from Khalid bin Abu Imran, from Ibn Umar, and he mentioned it.Tirmidhi said, "This is a hasan gharib hadith. Some of them narrated this hadith from Khalid bin Abu Imran, from Nafi, from Ibn Umar."I say, Ubaydullah bin Zahr is daif, but he was corroborated on the second version. The discussion of this is set out in detail in the book al-Azkar.