@AnonymousAs said, you can't cap on O2, but if you feel you need to, you could switch to Tesco Mobile. They use the O2 network and you can limit your monthly spend.
Assuming it's not gonna cost you £000's to get out of your o2 contract.
If you are getting near to your limit allowance I would advise you to check My O2 regularly. Out of allowance charges are quite expensive as you are aware. As said, consider a change of tariff to one with unlimited calls and texts. It may be cheaper in the long run than going over your minutes.
Track usage, upgrade and get support with the My O2 appDownload My O2