Talha bin Ubaydullah reported,

Two men from the tribe of Baliyy came to the Messenger of Allah ﷺ, and they embraced Islam together. One of them was more devoted in worship than the other. The more devoted one went out on a military expedition and was martyred. The other lived on for a year after him, then died.Talha said, I saw in a dream that I was at the gate of Paradise when suddenly I saw the two of them. Someone came out from Paradise and granted permission to the one who had died later to enter. Then he came out again and granted permission to the one who had been martyred. Then he returned to me and said, "Go back, for your time has not yet come."In the morning, Talha began telling the people about this, and they were astonished. The news reached the Messenger of Allah ﷺ, and they related the dream to him.He asked, "What part of this astonishes you?"They replied, "Messenger of Allah, this man was the more devoted in worship of the two and was then martyred, yet the other one entered Paradise before him."The Messenger of Allah ﷺ said, "Did this one not remain alive a year after him?"They said, "Yes."He said, "And did he not reach Ramadan, fast, and perform such-and-such number of prostrations in prayer during that year?"They said, "Yes."The Messenger of Allah ﷺ said, "Then the distance between them is greater than what lies between heaven and earth."

Ibn Majah 3925

Sahih

حدثنا محمد بن رمح أنبأنا الليث بن سعد عن ابن الهاد عن محمد بن إبراهيم التيمي عن أبي سلمة بن عبد الرحمن

عن طلحة بن عبيد الله

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

ابن ماجه 3925صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Dream interpretation
Chapter
Dream interpretation
Numbering
Darussalam 3925
Ibn Majah 3925