The Holy One, blessed be He, said: I made a stipulation with Abraham (in Genesis 15:15), "And you shall come to your fathers in peace; you shall be buried at a good old age." And this is a good end: that the righteous one goes out and they say to him, "See what your grandson is doing!" David said (in Psalms 63:4 [3]), "For Your lovingkindness is better than life." Therefore Abraham departed because of Esau. Know for yourself that it is so. Isaac, who came from the strength of Abraham, lived one hundred and eighty years, but Abraham lived only one hundred and seventy-five. The Holy One, blessed be He, said: So that he should not see Esau committing transgressions and cry out a protest against Him, therefore five years were subtracted from Abraham's life.
Why Abraham Died Five Years Early to Spare Him Esau's Sins
Midrash Tanchuma Buber, Toldot 3:2
אמר הקב"ה התניתי עם אברהם, ואתה תבא אל אבותיך בשלום תקבר בשיבה טובה (בראשית טו טו), וזה אחרית טובה, שיהא הצדיק יוצא לחוץ ויאמרו לו ראה בן בנך מה עושה, אמר דוד כי טוב חסדך מחיים (תהלים סג ד), לפיכך נסתלק אברהם בשביל עשו, תדע לך שכן הוא, יצחק שבא מכח אברהם חי ק"פ, ואברהם לא חיה אלא קע"ה, אמר הקב"ה שלא יראה עשו עובר עבירות וקורא תגר עליו, לפיכך נגרעו מחייו של אברהם ה' שנים.