Normally making vows is frowned upon by our sages as with someone playing with fire, but when it comes to girding oneself from sexual temptation, we find that making vows is praised by the Torah and by Chazal. The Ohr Hachayim (whose Yartzeit was yesterday) writes in this week's Parshas Matos (30:2):
Rough Translation (in short): "The Pasuk is saying here that there are Nedarim and Shvuos that Hashem commanded us to make... such as in cases where one has apprehension about stumbling in the area of arayos... to counteract the strength of this desire ...as Chaza"l say about Bo'az, that he swore to guard himself from transgressing when Ruth came to him in the silo at night, as it says "Chai Hashem, Shichvi ad haboker - In the name of G-d, lay here until morning". And as the Pasuk says, "Nishbati Va'akayeima, lishmor Mishpatei Tzidkecha - I have vowed and will uphold it; to guard your righteous laws", for it is a Mitzva to make a Shvuah against one's evil inclination."
Also, the Mishna says in Pirkei Avos: "Nedarim siyag la'prishus - Nedarim are a fence for abstinence ". And another Pasuk in Tehilim says "Nishba Lehora Velo Yamir - oseh eileh lo yimot le'olam - He who swears to prevent bad and does not nullify... he will never falter". So it is clear that there are cases when making Shvuos is actually a Mitzva that Hashem wants us to do!
However, as important and helpful as vows can be in fighting this powerful desire, they are also spiritually dangerous. The addiction is very often more powerful than vows. Therefore, it is vital that we learn how to make vows in a way that will work and be spiritually safe. Instead of fighting the addiction head-on through the vows, we can make vows that will help us "walk around" the addiction. Do not make a make vow that you simply will not act-out or look at inappropriate material. Many addicts have tried this and failed miserably, because when we are under a lust attack it is very hard for our yiras shamayim to stop us.
Download the TaPHSiC Method PDF file (6 pages) to learn this powerful "Shvuah" technique that has helped many frum addicts stop their destructive behaviors.
You can also read the TaPHSiC Method online at this link.