As you walk around in your cycling shoes, your soles will wear down, and there will be increasing play/looseness in the connection between pedal and cycling shoe. Also the metal cleat will scrape and wear down as it gets closer to the ground.
I've tried different glues and epoxies and a glue gun, to add thickness to the soles. Nothing seemed to stay on forever, until, in using the glue gun glue, I realized the importance of thoroughly cleaning the sole with isopropyl alcohol.
It's very quick to apply the glue, and you can use it almost immediately after it cools. It's easy to apply the correct thickness of glue. It is elastic so it moves with the sole, and if you put on too thick a layer, you can still engage the cleat because you can push hard to squish the glue-gun glue.
In the picture below, you can sense the desperation about not having the glue come off. I would much prefer a small patches of glue on either side of the cleat.
Update: As mentioned, it's important to clean the sole with isopropyl alcohol. I've improved adhesion by using super-glue as a first layer, before adding the glue-gun glue. Careful, the fumes will be rather toxic, when the heated glue contacts the superglue.
I'm not the only one trying to do this. In this thread the guy recommends Shoe Goo, which I've also tried in the past.
Update: While moving a heavy dewar filled with liquid nitrogen (I didn't splash any, so I don't think this was the cause), my sandals cracked. Or maybe it was that I was standing next to the delivery guy while he poured from his dewar to ours. Anyway, I noticed when I went to engage and started pedaling, that my foot felt funny: