How can I be free from pornography?
Pornography is one of the most difficult sins to overcome since it appeals to a person's base instincts. As with any sin or habit, breaking it will not be easy. But, there are some practical steps you can take while the Holy Spirit works on you from the inside.
First, when you are open with yourself about the problem and sincerely decide that you WANT help, you will need to find someone of the same sex whom you can trust and with whom you can be open about it (a prayer partner perhaps). You absolutely must make a decision to change. Make an agreement with that person that whenever you have the urge to view pornography, you will instead pray for the other person. They will do likewise for you. This will frustrate Satan's efforts, since every time he tempts you, it will cause you to pray for the other person, and vice versa.
It will take a lot of dependence on the Holy Spirit and a lot of time in prayer. When God mentioned that Cain's countenance had fallen due to his jealousy of his brother Abel, God told him; "If you do good, will not your countenance be lifted up? If not, sin is crouching at the door, it desires to have you , BUT YOU MUST MASTER IT" (Gen. 4:7).
This clearly put the onus on Cain, but notice that God tried to help him. Cain chose to disregard the advice. Finally, take the advice of James in his New Testament: "Resist the evil one and he will flee from you." Resisting requires action, not passivity. Take action against the devil and your sin through prayer and reading the Bible and fill your life with godly things and godly people.