Hi Frank, know exactly how you feel and like you I go through similar bad patches, but I never doubt my faith or salvation. I know and believe that God's love for me is not dependent upon my performance. That's why I chose Jesus and not Allah.
The Bible tells me that no matter how hard I try, God will never be satisfied with my performance-
But we are all like an unclean thing, And all our righteousnesses are like filthy rags; We all fade as a leaf, And our iniquities, like the wind, Have taken us away. Isaiah 64:6 NKJV
Jesus tells us such -
Many will say to Me in that day, ‘Lord, Lord, have we not prophesied in Your name, cast out demons in Your name, and done many wonders in Your name?’ And then I will declare to them, ‘I never knew you; depart from Me, you who practice lawlessness!’ Matthew 7:22-23 NKJV You can do wonderful miraculous things in Jesus' name but if you haven't accepted Him into your life, it counts for nothing.
In the epistles-
For the wages of sin is death, but the gift of God is eternal life in Christ Jesus our Lord. Romans 6:23 NKJV That's the end of that chapter, there's no buts or ifs.
So why even try? Well if you truly truly love and adore Jesus you'll want to try and please Him. You can do that by avoiding sin and following righteousness. Constant prayer and praise, frequent Bible reading, ask for God's control through His Holy Spirit.
Don't worry about the bad thoughts, Satan tempts and tailors his temptation to your weaknesses. I'm like you, lust is a problem but for others with a low sex drive they'll be tempted with greed, gambling, booze or a host of other indulgences. Put on the whole armour of God, Ephesians 6. On a lighter note, read CS Lewis's Screwtape Letters. A lighthearted account of an apprentice devil temting a guy that's seriously thinking of making a Christian commitment.