It is narrated from Sayyiduna Jabir (may Allah be pleased with him) that he said: I heard the Prophet (peace and blessings be upon him) three days before his death, and he (peace and blessings be upon him) said: "Let none of you die except while he holds a good opinion of his Lord."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 6566