When the Messenger of Allah ﷺ went to his bed at night, he would say: in the name of Allah, I have laid down my side for Allah. O Allah! forgive me my sin, drive away my devil, free me from my responsibility, and place me in the highest assembly. Abu Dawud said: Abu Hammam al-Ahwazi transmitted it from Thawr. He mentioned Abu Zuhair al-Anmari (instead of Abu al-Azhar).
أَنَّ رَسُولَ اللَّهِ ﷺ كَانَ إِذَا أَخَذَ مَضْجَعَهُ مِنَ اللَّيْلِ قَالَ بِسْمِ اللَّهِ وَضَعْتُ جَنْبِي اللَّهُمَّ اغْفِرْ لِي ذَنْبِي وَأَخْسِئْ شَيْطَانِي وَفُكَّ رِهَانِي وَاجْعَلْنِي فِي النَّدِيِّ الأَعْلَى