It is narrated from a man of Banu Khatmah that the Prophet (peace and blessings be upon him) said: "When one of you sees a louse on his garment (during prayer), let him crush it right there or tie it up (in a corner of the garment), and let him not throw it in the mosque."
Imam Musaddad also recorded it in the same way through Yahya bin Zuray'.
Al-Harith bin Muhammad bin Abi Usamah also recorded it with the chain of Yahya bin Abi Kathir, through a man of the Ansar, from the Messenger of Allah (peace and blessings be upon him).
I (the author) say: Imam Abu Dawud recorded it in 'al-Marasil' through Yahya and al-Hadrami from a man of the Ansar.
Imam Ahmad bin Hanbal recorded it from Hajjaj al-Sawwaf, and Imam al-Bayhaqi in his 'Sunan' with the chains of Muslim bin Ibrahim and Ali bin Mubarak, through Yahya bin Abi Kathir.
Technically, this narration is mursal hasan (a good report with the Companion missing).
Imam al-Bayhaqi said: It has reached us from Malik bin Yukhamir (may Allah have mercy on him) that he said: "I saw Sayyiduna Mu'adh bin Jabal (may Allah be pleased with him) killing fleas and lice during prayer." And al-Hasan al-Basri (may Allah have mercy on him) said: "There is no harm in killing lice during prayer, but one should not fidget (in doing so)."
Hadith Referenceإتحاف الخيرة المهرة بزوائد المسانيد العشرة / كتاب المساجد / 996
Hadith Gradingمحدثین:إسناده حسن مرسلًا؛ لإبهام الرجل من بني خطمة وعدم ثبوت صحبته