Is Dusting the Bed before Sleeping Sunnah?
Question

When should we dust off the bed three times? Is it before sleeping or after? How should it be done?
Praise be to Allah.Al-Bukhari (6320) and Muslim (2714) narrated that Abu Hurayrah (may Allah be pleased with him) said: The Prophet (peace and blessings of Allah 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 Rabbi wada`tu janbi wa bika arfa`uhu wa in amsakta nafsi farhamha wa in arsaltaha fahfadh-ha bima tahfadhu bihi `ibadika As-salihin ( 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).” 
An-Nawawi (may Allah have mercy on him) said in Sharh Muslim:
“The inside of his lower garment” means its edge. What is meant is that it is recommended 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.” 
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. 
For more details, please see the following answers: 21216 , 30784 , 145543 , 72591 , 21647 ,  and 50010 .
And Allah knows best.