What's been working for me is a series of exercises and stretches. I think what's working is the actual exercise rather than the stretch.
I'll use bands while performing leg lateral raises and also lifting my knee to my chest (with bands as well). This way I'm actually forced to use my hip flexor muscles. Funny enough from my experience tight hip flexors are usually weak hip flexors that caused other parts of your body to compensate, which then causes you pain.
Stretch wise, I do the standard pigeon pose, piriformis stretch, and butterfly stretch.