There is no real way to 'bank' any of your spare money in any (main-series) Pokemon games as far as I am aware.
Your best bet to not lose in the first place, which may mean over-training one or two Pokemon in your team so that they are sufficiently over-leveled for any challenging foe that crosses the rest of your team. And though it may be annoying to reset a gym's puzzles, leave before fighting the leader for the badge and heal up at a Pokecenter. The various trainers in a gym may not be particularly strong, but they can chip away at your preparedness for the leader, who often have at least one higher-leveled Pokemon that may be challenging.
The only other things I can suggest is to invest in some escape ropes (to leave caves and such when your party is low on health), and to spend the extra cash on the best Potions available, Full Heals, Full Restores, and Revives. Buying these will help ensure future battles go better so that you don't lose. Also, hang on to all the Gold Nuggets and similar items that have no use beyond selling until you need the money.
If you are planning on getting any Pokemon or TMs from the Celadon Game Corner, consider turning your cash into coins at the service desk ASAP.