It is Sunnah to dust off the bed before sleeping
Al-Bukhaari (6320) and Muslim (2714) narrated that Abu Hurayrah (may Allaah be pleased with him) said: The Prophet (peace and blessings of Allaah be upon him) said: “When one of you goes to his bed, let him dust off his bed with the inside of his lower garment, for he does not know what came onto it after he left it. Then let him say: Bismika Rabbee wada’tu janbi wa bika arfa’uhu wa in amsakta nafsi farhamhaa wa in arsaltahaa fahfazhaa bimaa tuhfaz bihi ‘ibaadika al-saaliheen ( In Your name, my Lord, I lie down, and in Your name I rise. If You should take my soul then have mercy on it, and if You should return my soul then protect it as You protect Your righteous slaves).”
Al-Nawawi (may Allaah have mercy on him) said in Sharh Muslim: “the inside of his lower garment” means its edge. What is meant is that it is mustahabb to dust down his bed before lying on it, lest there be a snake or scorpion or other harmful thing in it. And he should dust it down with his hand covered by the edge of his lower garment, lest something bad happen to his hand if there is anything there. End quote.
Hence it is known that dusting down the bed is to be done when one wants to sleep, and it may be done with the edge of one’s garment or something else.
And Allaah knows best.