I can only share my experience and what worked for me. If you identify with it fine, otherwise I hope I don't bore you.
For years I searched for the spiritual connection, or so i thought.Over the years i developed a dependency on these spiritual feelings, and my acting out became a function of this too. Whether the chicken came before the egg, or the egg before the chicken i.e. whether i acted out because I was missing the spiritual high or I felt down because i acted out etc is irrelevant. The point is that my whole life I ping ponged between spiritual high and acting out.
Of course i was not aware of this at the time. i thought that I had a genuine yearning for spirituality. I did! But I defined that spirituality. And Gd was allowed in, when it suited me. Of course when I was feeling down, which was a good excuse to act out, I politely kicked Him out of my life. I could not handle the internal conflict.
After coming to SA, I discovered that i had been living completely wrong. As the 12 and 12 describes it at the end of Step 2:
To clergymen, doctors, friends, and families, the alcoholic
who means well and tries hard is a heartbreaking
riddle. To most A.A.'s, he is not. There are too many of us
who have been just like him, and have found the riddle's
answer. This answer has to do with the quality of faith
rather than its quantity. This has been our blind spot. We
supposed we had humility when really we hadn't. We supposed
we had been serious about religious practices when,
upon honest appraisal, we found we had been only superficial.
Or, going to the other extreme, we had wallowed in
emotionalism and had mistaken it for true religious feeling.
In both cases, we had been asking something for nothing
For most normal people I don't think there is anything too wrong with this, but for me it was poison. And coming to terms with it was one of the hardest things I had to do.
So i cut out doing anything religious which was not Shulchan Aruch - (SA), all the extras! mussar, haskafa etc. Maybe it was a bit extreme, and it was hell. But I could not go back there once I came to face the fact that it had all been phony as genuine as it seemed.
But after a while with the help of meetings and friends in SA, i started to talk to HaShem about REAL things; yes the little annoying things in life, the frustrations, the resentments, the fears, and most of all the feeling in between my legs. i discovered that he IS there for those things too, that He cares, that He loves me unconditionally and that nothing is too big or too insignificant for Him to deal with.
My connection with him is no longer dependent on whether i daavened with a minyan in the morning, or whether I learnt with my chavrusa. And he is there for me whenever I need and want. And now I have the choice not too act out, and instead to turn too him for whatever I am searching for in lust.
May he grant us a sober and sane day.