Praise be to Allah.
This swearing by the Prophet (peace and blessings of Allaah be upon him) is haraam, and is a kind of Shirk, because swearing by something implies veneration of it, and a created being cannot venerate another created being. Hence the Prophet (peace and blessings of Allaah be upon him) said: “Whoever swears by anything other than Allaah is guilty of kufr or shirk.”
(Saheeh, narrated by Ahmad, 2/125; Abu Dawood, 3251; al-Tirmidhi, 1535). This applies to swearing by the Prophets, angels, righteous people and all other created beings. And the Prophet (peace and blessings of Allaah be upon him) said: “Whoever swears an oath, let him swear by Allaah or else remain silent.” (Narrated by al-Bukhaari,4860 – al-Fath 8/611 and 6107 – al-Fath 10/516; Muslim, 1647; Ahmad, 2/309; Abu Dawood, 3247; al-Nasaa’i, 3775; al-Tirmidhi, 1545; Ibn Maajah, 2096).
With regard to the verses in the Qur’aan which contain oaths sworn by “those sent forth” (al-mursalaat), the winds that scatter (al-dhaariyaat), those who pull out (al-naazi’aat), the break of day (al-fajr), the Time (al-‘asr), the forenoon (al-duhaa) and the mansions of the stars (mawaaqi’ al-nujoom – see al-Waaqi’ah 56:75), etc., these are oaths sworn by Allaah, and Allaah has the right to swear oaths by whatever He wills, but the created being can swear only be his Lord, may he be exalted.