توفي رحمه الله تعالى، فيما حكاه أبو بكر المالكي: في صفر سنة إحدى وأربعين، وقد جاوز السبعين. وخرج الناس من القيروان وغيرها، الى جنازته بسوسة. قال ابنه: قال لي أبي ليلة من الليالي، في مرضه الذي توفي فيه: وا بني، اربط لي حبلا في السقف، لعلي أقدر أصلي قائما. ففعلت. وحملناه حتى وقف. وغلب، ولم يستطع القيام. فبكى، وقال: وا حزناه. حيل بيني وبين طاعة ربي. فذكرت له الصلاة جالسا. فقال: يا بني، العمر قصير، والعمل قليل. وإنما أردت أن أعمل أكثر مما عملت. ولما أطال به المرض قال لزوجته: قد توليت مني خيرا. فاصبري. فما أشك أن أجلي قد اقترب. فإني سمعت هاتفا من هذا الطاق يقول: أحسن غدا صلاة الظهر، يفرج عنك. فمات ذلك الوقت.
He died, God Most High have mercy on him, according to what Abu Bakr al-Maliki related, in Safar of the year 41, having passed seventy. People came out from al-Qayrawan and elsewhere to his funeral in Susa. His son said: My father said to me one night, during the illness of which he died: My son, tie a rope for me to the ceiling; perhaps I shall be able to pray standing. I did so, and we lifted him until he stood; but he was overcome and could not stand. He wept and said: O grief! I have been barred from obeying my Lord. I mentioned to him praying sitting. He said: My son, life is short and works are few; I only wanted to do more than I have done. When his illness grew long, he said to his wife: You have done me good; so be patient, for I do not doubt that my term has drawn near, for I heard a voice from this window saying: Perform the noon prayer well tomorrow, and you will be relieved. And he died at that time.