It's hard to give specific advice without knowing more about the situation but i would strongly advise seeing a physio or something similar.
I helped my mum get over adductor muscle issues (random cramping and pain in gracilis) through trigger point massage (targeting injured points in the muscle to release the tension), stretching and strengthening exercises. I would say that the massage was the biggest thing that helped her- she just had some kinda hand held massage thing that she would hold on the (giant!)knotted/ spasming areas in the muscle. So it might be an idea to feel along the muscle and try to find knotted areas or lines of tension and hold pressure along them to release it. You might be surprised to find lumps in the muscle that you were previously unaware of.
Also, as far as stretching and strengthening goes, think of your hip as a quadrant, with the stabilising muscles being the abductors, adductors and hip flexor groups. Muscle imbalances in any of these groups will cause imbalances in movement and overcompensation by the other muscles. So if it is an adductor group muscle that is the problem (eg pectineus), it's advisable to progressively strengthen the abductor group. If you find it's the psoas muscle that you want to strengthen, then strengthen the other muscles as well, because of the relationship between them.
Also, perhaps look at bike setup, maybe it is forcing you to overuse a muscle group.
Try to find out what triggers you off if it's at all possible and avoid doing that thing for a good few weeks (it takes longer than you might think to recover) and gradually build up again.