The Statement of Allah: “...The second of two, when they (Muhammad ﷺ and Abü Bakr were in the cave, and he ﷺ said to his companion (Abu Bakr ) ‘Be not sad (or afraid), surely Allah is with us.'" (V.9:40)
Narrated Abu Bakr:I was in the company of the Prophet (ﷺ) in the cave, and on seeing the traces of the pagans, I said, "O Allah's Messenger (ﷺ) If one of them (pagans) should lift up his foot, he will see us." He said, "What do you think of two, the third of whom is Allah?"
Reference
Sahih al-Bukhari 4663
In-book reference
Book 65, Hadith 185
USC-MSA web (English)
Vol. 6, Book 60, Hadith 185
Translation by Dr. M. Muhsin Khan · Language: EN
Sahih
Arabic Text
حَدَّثَنَا عَبْدُ اللَّهِ بْنُ مُحَمَّدٍ، حَدَّثَنَا حَبَّانُ، حَدَّثَنَا هَمَّامٌ، حَدَّثَنَا ثَابِتٌ، حَدَّثَنَا أَنَسٌ، قَالَ حَدَّثَنِي أَبُو بَكْرٍ ـ رضى الله عنه ـ قَالَ كُنْتُ مَعَ النَّبِيِّ صلى الله عليه وسلم فِي الْغَارِ، فَرَأَيْتُ آثَارَ الْمُشْرِكِينَ قُلْتُ يَا رَسُولَ اللَّهِ، لَوْ أَنَّ أَحَدَهُمْ رَفَعَ قَدَمَهُ رَآنَا. قَالَ " مَا ظَنُّكَ بِاثْنَيْنِ اللَّهُ ثَالِثُهُمَا ".