If a Muslim declares something to be haraam for himself that Allaah has permitted, this comes under the same ruling as an oath (yameen).
The evidence for that is the verse in which Allaah says (interpretation of the meaning):
“O Prophet! Why do you forbid (for yourself) that which Allaah has allowed to you, seeking to please your wives? And Allaah is Oft‑Forgiving, Most Merciful.
2. Allaah has already ordained for you (O men) the absolution from your oaths. And Allaah is your Mawlaa (Lord, or Master, or Protector) and He is the All‑Knower, the All‑Wise”
Al-Sa’di (may Allaah have mercy on him) said in his Tafseer (p. 1035):
This is a rebuke from Allaah to His Prophet Muhammad (peace and blessings of Allaah be upon him), when he declared that his concubine Maryah and drinks of honey were forbidden to him, in order to please some of his wives, as narrated in the well-known story, whereupon Allaah revealed these verses.
The fact that he forbade these things to himself led to the revelation of a general ruling which applies to the entire ummah. Allaah said: “Allaah has already ordained for you (O men) the absolution from your oaths”. This is general and applies to all oaths sworn by the believers.
Everyone who declares that something permissible is forbidden to him, such as food, drink or concubines, or swears an oath by Allaah that he will do something or nor do something, then breaks that oath or wants to break it, has to offer the expiation mentioned.
You have to offer kafaarat yameen for your declaring that your husband is forbidden to you like your father. This expiation means feeding ten poor persons, giving each one a kilo and a half of staple food, or clothing them, giving a garment to each one, or freeing a believing slave. If you cannot do any of these three things, then you have to fast for three days. Your husband is not forbidden to you. And you have to repent to Allaah from that, because it is not permissible for a Muslim to forbid to himself something that has been permitted by Allaah.
From Fataawa al-Lajnah al-Daa’imah li’l-Ifta’, 23/189.