I felt powerless to resist the sinful thoughts/behavior, even if I tried very hard praying...
Because of your sinful nature. It's not hard for the devil to tempt someone since he's an expert. If you make any poor decisions, small or great, you can be opened up to temptation. The more you believe in Jesus, the more satan is on the prowl for you. The only way you can conquer these evil spirits is by making godly decisions and studying the word of God continually. Sometimes The Lord will allow your prayers to go unanswered because you asked with the wrong motives, or you have made a bad decision and the Lord wants you to receive the temporary consequences, a sort of tough love. There is good news though, because the more you make godly decisions the more chances there are you are not far from Gods will and that you will get prayers answered. The flipside of the coin is that if you make bad decisions, it becomes easier and easier to make more and more. A quote that continually pops in my mind is this (from Genesis 4:6-8 NIV):
6 Then the LORD said to Cain, "Why are you angry? Why is your face downcast? 7 If you do what is right, will you not be accepted? But if you do not do what is right, sin is crouching at your door; it desires to have you, but you must master it."
God gives people a choice to sin or to do what is right, so if they intentionally sin, especially, they will reap undesirable consequences regardless of their relationship with Him. If you sin, you might end up in a minefield of sin, or a bad situation where there is hopeless temptation all around because of a simple insignificant decision you made earlier without thinking through. And it is in the power of the Holy Spirit to enable you to make good decisions. Read this from 1 Corinthians 10:12-14:
No temptation has seized you except what is common to man. And God is faithful; he will not let you be tempted beyond what you can bear. But when you are tempted, he will also provide a way out so that you can stand up under it.
One other thing I've had problems with is trying to hard, or trying to be a good person. This is a good way to come up with very offensive abominations towards God, and at the very least get prayers unanswered. In the past, I've made vows, for example "I vow to follow my diet perfectly today". That is dangerous, and opens you up to more temptation than ever because you just said to God "I'm gonna do this myself, I don't really need you that much anymore." That's not what you're thinking, but that's what my deceptive sinful heart has been saying. Trying to do good things for God is like offering Him contaminated rags. He does good things through us, and by faith that he has enabled us to have.