Fine yourself 50 dollars (to be paid to tzedaka) for each time you view pornography, enforced with a neder (vow), and with a maximum of 100 dollars per day.
Make a condition that the neder be valid only if you remember it beforehand and that it is valid for one or two weeks only. (You can renew it after.)
You'll squash the habit in no time.
However, this assumes you will not transgress a neder under any circumstance. Otherwise, it wont work, and you'll be worse off in that you'll likely be violating a neder. (see the book Orech Apayim on anger which discusses this technique and suggests not eating anything until the fine is payed)
This technique is extreme but, if you have yiras shamayim, it works and is a gold mine.
I've used it successfully to break some deeply ingrained bad habits (not pornography related) that I'm convinced I would never have succeeded in breaking without this method. (although for some things like not getting angry, it wont work since it's too vague and too hard. must be action related things such as not smoking or not hitting your kid.)
Warning: Making a neder/vow is very serious and can incur severe punishments from upstairs. always check with your LOA first.