Hadith 36, 40 Hadith Qudsi
On the authority of Anas (may Allah be pleased with him) from the Prophet (ﷺ), who said:
The believers will gather together on the Day of Resurrection and will say: Should we not ask [someone] to intercede for us with our Lord? So they will come to Adam and will say: You are the Father of mankind; Allah created you with His hand, He made His angels bow down to you and He taught you the names of everything, so intercede for us with your Lord so that He may give us relief form this place where we are. And he will say: I am not in a position [to do that] - and he will mention his wrongdoing and will feel ashamed and will say: Go to Noah, for he is the first messenger that Allah sent to the inhabitants of the earth. So they will come to him and he will say: I am not in a position [to do that] - and he will mention his having requested something of his Lord about which he had no [proper] knowledge (Quran Chapter 11 Verses 45-46), and he will feel ashamed and will say: Go to the Friend of the Merciful (Abraham). So they will come to him and he will say: I am not in a position [to do that]. Go to Moses, a servant to whom Allah talked and to whom He gave the Torah. So they will come to him and he will say: I am not in a position [to do that] - and he will mention the taking of a life other that for a life (Quran Chapter 28 Verses 15-16), and he will feel ashamed in the sight of his Lord and will say: Go to Jesus, Allah's servant and messenger, Allah's word and spirit. So they will come to him and he will say: I am not in a position [to do that]. Go to Muhammad (may the blessings and peace of Allah be upon him), a servant to whom Allah has forgiven all his wrongdoing, past and future. So they will come to me and I shall set forth to ask permission to come to my Lord, and permission will be given, and when I shall see my Lord I shall prostrate myself. He will leave me thus for such time as it pleases Him, and then it will be said [to me]: Raise your head. Ask and it will be granted. Speak and it will be heard. Intercede and your intercession will be accepted. So I shall raise my head and praise Him with a form of praise that He will teach me. Then I shall intercede and He will set me a limit [as to the number of people], so I shall admit them into Paradise. Then I shall return to Him, and when I shall see my Lord [I shall bow down] as before. Then I shall intercede and He will set me a limit [as to the number of people]. So I shall admit them into Paradise. Then I shall return for a third time, then a fourth, and I shall say: There remains in Hell-fire only those whom the Qur'an has confined and who must be there for eternity. There shall come out of Hell-fire he who has said: There is no god but Allah and who has in his heart goodness weighing a barley-corn; then there shall come out of Hell-fire he who has said: There is no god but Allah and who has in his heart goodness weighing a grain of wheat; then there shall come out of Hell-fire he who has said: There is no god but Allah and who has in his heart goodness weighing an atom.

It was related by al-Bukhari (also by Muslim, at-Tirmidhi, and Ibn Majah).
عَنْ أَنَسٍ ،  رَضِيَ اللهُ عَنْهُ ، عَنِ النَّبِيِّ صَلَّى الله عَلَيْهِ وَ سَلَّمَ ، قَالَ 
يَجْتَمِعُ المُؤْمِنُونَ يَوْمَ القِيَامَةِ فَيَقُولُونَ : لَوِ اسْتَشْفَعْنَا إلى رَبِّنَا ، فَيَأْتُونَ ادَمَ ، فَيَقُولُونَ : أَنْتَ أَبو النَّاسِ ، خَلَقَكَ اللهُ بِيَدِهِ ، وَأَسْجَدَ لَكَ مَلائِكَتَهُ ، وَعَلَّمَكَ أَسْماءَ كُلِّ شَيْءٍ ، فاشْفَعْ لَنا عِنْدَ رَبِّكَ ، حَتَّى يُرِيحَنا مِنْ مَكَانِنا هَذا ، فَيَقُولُ : لَسْتُ هُنَاكُمْ ـ وَيَذْكُرُ ذَنْبَهُ ، فَيَسْتَحْيي ـ ائْتُوا نُوحاً ؛ فَإِنَّهُ أَوَّلُ رَسُولٍ بَعَثَهُ اللهُ إِلي أَهْلِ الأَرْض ، فَيَأْتُونَهُ ، فَيَقُولُ : لَسْتُ هُنَاكُمْ ـ ويَذْكُرُ سُؤالَهُ رَبَّهُ مَا لَيْسَ لَهُ بِهِ عِلْمٌ ، فَيَسْتَحْيي ـ فَيَقُولُ : اؤْتُوا خَلِيلَ الرَّحْمنِ ، فَيَأْتُونَهُ ، فَيَقُولُ : لَسْتُ هُنَاكُم ،   اؤْتُوا موسى ، عَبْداً كَلَّمَهُ اللهُ ، و أَعْطَاهُ التَّوْرَاةَ . فَيَأْتُونَهُ ، فَيَقُولُ : لَسْتُ هُنَاكُمْ ـ وَيَذْكُرُ  قَتْلَ النَّفْسِ بِغَيْرِ نَفْسٍ ، فَيَسْتَحْيي مِنْ رَبِّهِ ـ فَيَقُولُ : اؤْتُوا عِيسَى ، عَبْدَ اللهِ وَرَسُولَهُ ، وَكَلِمَةَ اللهِ وَرُوحَهُ . فَيَأْتُونَهُ ، فَيَقُولُ : لَسْتُ هُنَاكُمْ ، اؤْتُوا مُحَمَّداً ، ـ صَلَّى الله عَلَيْهِ وَ سَلَّمَ ـ عَبْداً غَفَرَ اللهُ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ وَمَا تَأَخَّرَ ، فَيَأْتُونَنِي ، فَأَنْطَلِقُ حَتَّي أَسْتَأْذِنَ عَلَي رَبِّي فَيُؤْذَنُ . فإذا رَأَيْتُ رَبِّي وَقَعْتُ سَاجداً ، فَيَدَعُني مَا شَاءَ اللهُ ، ثُمَّ يُقَالُ : ارْفَعْ رَأْسَكَ ، وسَلْ تُعْطَهُ ، وَقُلْ يُسْمَعْ ، واشْفَعْ تُشَفَّعْ . فَأَرْفَعُ رَأْسي ، فَأَحْمَدُهُ بِتَحْمِيدٍ يُعَلِّمُنِيهِ ، ثُمَّ أَشْفَعُ ، فَيحُدُّ لي حَدّاً ، فَأُدْخِلُهُمْ الجَنَّةَ . ثُمَّ أَعُودُ إِلَيْهِ ، فإِذا رَأَيْتُ رَبِّي ( فَأَقَعُ ساجداً ) مِثْلَهُ ، ثُمَّ أَشْفَعُ فَيَحُدُّ لِي حَدّاً ، فَأُدْخِلُهُمُ الجَنَّةَ . ثُمَّ أَعُودُ الثالِثةَ ، ثُمَّ أَعُودُ الرَّابعة ، فَأقُولُ : مَا بَقِي في النَّارِ إِلَّا مَنْ حَبَسَهُ القُرْانُ ، ووَجَبَ عَلَيْهِ الخُلُودُ 
رواه البخاري ( وكذلك مسلم والترمذي وابن ماجه ) و في رواية أخرى للبخاري زيادة هي 
قَالَ النَّبِيُّ صَلَّى الله عَلَيْهِ وَ سَلَّمَ ، يَخْرُجُ مِنَ النَّارِ مَنْ قَالَ : لَا إِلهَ إِلَّا اللهُ ، وكَانَ فِي قَلْبِهِ مِنَ الخَيْرِ مَا يَزِنُ شَعِيرةً ، ثُمَّ يَخْرُجُ مِنَ النَّارِ مَنْ قَالَ : لَا إِلهَ إِلَّا اللهُ ، وكَانَ فِي قَلْبِهِ مِنَ الخَيْرِ مَا يَزِنُ بُرَّةً ، ثُمَّ يَخْرُجُ مِنَ النَّارِ مَنْ قَالَ : لَا إِلهَ إِلَّا اللهُ ، وكَانَ فِي قَلْبِهِ مَا يَزِنُ مِنَ الخَيْرِ ذَرَّةً