In a narration which is Marfu' (attributed to the Prophet) reported by Abu Dawud and an-Nasa'i from Abu Hurairah (RA) it has:
"Do not swear by your fathers, nor by your mothers, nor by the rivals (set up as equals with Allah); and do not swear by Allah except when you are speaking the truth." (DE)
Reference (DE): Bulugh al-Maram 1375 (DE)
In-book reference (DE): Book 13, Hadith 2 (DE)
English translation (DE): Book 13, Hadith 1375 (DE)