It's a case of use it or lose it if you change providers.
Just stop topping up and use your credit before you switch.
You'll need your PAC to keep your number when you do so.
One way round it is to take out a 30 day contract
Your credit will be transferred to your contract
Cancel after a week under the change of mind policy
O2 will then refund the credit into the same account used to register for the contract
Track usage, upgrade and get support with the My O2 appDownload My O2