There are probably many hadith for this. One of them is this one.
....Anas then said, "Muhammad talked to us saying, 'On the Day of
Resurrection the people will surge with each other like waves, and
then they will come to Adam and say, 'Please intercede for us with
your Lord.' He will say, 'I am not fit for that but you'd better go to
Abraham as he is the Khalil of the Beneficent.' They will go to
Abraham and he will say, 'I am not fit for that, but you'd better go
to Moses as he is the one to whom Allah spoke directly.' So they will
go to Moses and he will say, 'I am not fit for that, but you'd better
go to Jesus as he is a soul created by Allah and His Word.' (Be: And
it was) they will go to Jesus and he will say, 'I am not fit for that,
but you'd better go to Muhammad.' They would come to me and I would
say, 'I am for that.' Then I will ask for my Lord's permission, and it
will be given, and then He will inspire me to praise Him with such
praises as I do not know now. So I will praise Him with those praises
and will fall down, prostrate before Him. Then it will be said, 'O
Muhammad, raise your head and speak, for you will be listened to; and
ask, for your will be granted (your request); and intercede, for your
intercession will be accepted.' I will say, 'O Lord, my followers! My
followers!' And then it will be said, 'Go and take out of Hell (Fire)
all those who have faith in their hearts, equal to the weight of a
barley grain.' I will go and do so and return to praise Him with the
same praises, and fall down (prostrate) before Him. Then it will be
said, 'O Muhammad, raise your head and speak, for you will be listened
to, and ask, for you will be granted (your request); and intercede,
for your intercession will be accepted.' I will say, 'O Lord, my
followers! My followers!' It will be said, 'Go and take out of it all
those who have faith in their hearts equal to the weight of a small
ant or a mustard seed.' I will go and do so and return to praise Him
with the same praises, and fall down in prostration before Him. It
will be said, 'O, Muhammad, raise your head and speak, for you will be
listened to, and ask, for you will be granted (your request)....
You can read the full hadith in Sahih al-Bukhari 7510