It may be worth trying setting the phone to use 3G only, so that it cannot switch down to 2G when the data fails to respond.
This will work well in marginal areas, but means you get no service at all in the many areas where O2 are the only company with only 2G coverage.
The simplest solution seems to be to carry a MiFi device on a different network (EE or Three) that can be switched on whenever giffgaff data is unusable.
I don't know whether there is any way to get a phone to automatically use mobile data in preference to WiFi, but to switch automatically whenever needed.
It's really annoying to find I've accidentally been using my small Three allowance on the giffgaff community when I have a much larger giffgaff allowance that won't get fully used.