Abu Musa Ashari reported,

We prayed Maghrib with the Messenger of Allah ﷺ, then we said, "Why don't we stay until we pray Isha with him?" So we sat waiting.He came out to us and asked, "Are you still here?"We said, "Messenger of Allah, we prayed Maghrib with you, then we said we would sit until we pray Isha with you."He said, "You have done well," or, "You have done right."Then he raised his head to the sky, as he often did, and said, "The stars are a source of security for the sky. When the stars disappear, what has been promised will come to the sky. I am a source of security for my companions. When I am gone, what has been promised will come to my companions. And my companions are a source of security for my ummah. When my companions are gone, what has been promised will come to my ummah."

Azami 9810

Sahih

عن أبي موسى الأشعري قال

صلينا المغرب مع رسول الله ﷺ، ثم قلنا: لو جلسنا حتى نصلى معه العشاء، قال: فجلسنا، فخرج علينا، فقال: ما زلتم ها هنا؟ قلنا: يا رسول الله، صلينا معك المغرب، ثم قلنا: نجلس حتى نصلى معك العشاء. قال: أحسنتم أو أصبتم. قال: فرفع رأسه إلى السماء، وكان كثيرا مما يرفع رأسه إلى السماء، فقال: النجوم أمنة للسماء، فإذا ذهبت النجوم أتى السماء ما توعد، وأنا أمنة لأصحابي، فإذا ذهبت أتى أصحابي ما يوعدون، وأصحابي أمنة لأمتي، فإذا ذهب أصحابي أتى أمتي ما يوعدون.

الأعظمي 9810صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Virtues of the Companions and reports about them
Chapter
Virtue of companionship
Section
That the remaining of the Prophet ﷺ was security for his companions, and the remaining of his companions is security for the ummah
Numbering
Jami al-Kamil 9810 (2nd edition)
Azami 9810