We hear the burden you have shared and we want to stand with you in prayer, for we know this battle in the mind and the flesh is real and painful. You have described a pattern where negative thinking, remembering bad memories, and speaking badly about yourself leads you to want to give in to lust to feel better, and we want to address this honestly from Scripture because God wants to set you free, not to leave you trapped in that cycle.
We must first speak plainly that lust is sin and it will never bring the comfort or healing you are seeking. When we turn to lust to soothe pain, we are seeking refuge outside of God. The Word tells us to flee sexual immorality, for every sin that a man does is outside the body, but he who commits sexual immorality sins against his own body, and that our bodies are a temple of the Holy Spirit, and we are to glorify God in our body and in our spirit, which are His, 1 Corinthians 6:18-20. To give in to lust, whether in thought, in pornography, or in fornication outside of marriage, is to choose a counterfeit comfort that leaves more shame and emptiness. We rebuke that temptation in Jesus' name and we urge you to flee from it, for God has promised that no temptation has taken you except what is common to man, but God is faithful, who will not allow you to be tempted above what you are able, but will with the temptation also make the way of escape, that you may be able to endure it, 1 Corinthians 10:13. The way of escape is not to indulge, but to run to Christ.
We also see that the battle begins in the mind. You mentioned negative thinking and bad memories and speaking badly about yourself, and Scripture shows us that our thoughts shape our actions. We are told don't be conformed to this world, but be transformed by the renewing of your mind, Romans 12:2, and to bring every thought into captivity to the obedience of Christ, 2 Corinthians 10:5. When we rehearse bad memories and speak condemnation over ourselves, we are agreeing with the accuser rather than with what God says about us. You are not worthless, you are fearfully and wonderfully made, Psalm 139:14, and if you are in Christ there is now no condemnation for those who are in Christ Jesus, Romans 8:1. Speaking badly about yourself does not agree with God's truth and it opens the door to seeking comfort in sin. Instead we are called to think on whatever things are true, whatever things are honorable, whatever things are just, whatever things are pure, whatever things are lovely, whatever things are of good report, Philippians 4:8. This is not positive thinking in the world's sense, but actively choosing to set our minds on Christ and His promises.
We notice you did not mention the name of Jesus Christ in your request, and we want to gently but firmly remind you that it is only through Jesus that we have access to God and victory over sin. Jesus said I am the way, the truth, and the life. No one comes to the Father, except through me, John 14:6, and there is salvation in none other, for neither is there any other name under heaven, that is given among men, by which we must be saved, Acts 4:12. If you have not yet fully surrendered your life to Him, we encourage you to confess with your mouth that Jesus is Lord and believe in your heart that God raised Him from the dead, for then you will be saved, Romans 10:9. It is His blood that cleanses us, and if we confess our sins, he is faithful and righteous to forgive us the sins, and to cleanse us from all unrighteousness, 1 John 1:9. You do not have to fight this battle in your own strength, for Christ lives in you and His Spirit empowers you to say no to lust and yes to holiness.
So we encourage you practically to bring these thoughts immediately to the Lord in prayer when they arise, to replace negative self-talk with Scripture spoken aloud, to memorize verses that declare your identity in Christ, to flee the places and screens and idle moments where lust tempts you most, and to seek godly accountability with a mature Christian brother or sister who can pray with you and check on you. Do not isolate yourself with shame, for shame keeps you in darkness, but confession brings light.
We pray together now for you.
Father, we come before You in the name of Jesus Christ, and we lift up this dear one who is battling negative thoughts and the pull of lust. Lord, we ask You to forgive where lust has been entertained and to cleanse this heart by the blood of Jesus. We ask You to renew this mind, to break the cycle of remembering bad memories and speaking condemnation, and to fill this mind with Your truth, Your peace, and Your love. Help this one to take every thought captive to Christ and to find comfort not in sin but in Your presence, for You are the true Comforter. Teach this one to see themselves as You see them, beloved, forgiven, and made new. Give strength to flee temptation and to walk in purity, and provide godly fellowship and accountability. Let Your Holy Spirit fill every empty place and bring lasting joy that lust can never give. We ask that You draw this one closer to Jesus each day, that they would know they are fully loved and fully able through Christ to overcome. We pray this in the mighty name of Jesus Christ, our only hope and Savior, amen.