The Frostburn spell mantle of the icy soul permanently grants the cold subtype, making the recipient immune to cold damage at the price of being vulnerable to fire. Anything that made you immune to fire would also protect you from the extra damage, giving the mantle no backdraw.
The Sandstorm spell mantle of the fiery spirit permanently grants the fire subtype and everything I said about the cold subtype is valid in reverse.
So if you get both spells on you, you're immune to cold and fire without spending spell slots (the two spells are of course dispellable so you'd better have an high level caster with +CL rings cast them).
The process could be costly and involve having someone cast a spell on you (it's both cleric or druid spells and the latter is high level) but the effectiveness is unrivaled.
Energy immunity is a Complete Arcane level 7 wizard/sorcerer spell that gives you immunity to one of the five energy types for 24 hours.
In the words of the SRD:
Same Effect with Differing Results
The same spell can sometimes produce varying effects if applied to the same recipient more than once. Usually the last spell in the series trumps the others. None of the previous spells are actually removed or dispelled, but their effects become irrelevant while the final spell in the series lasts.
This means different energy immunity spells don't overlap so this can protect you from one energy type only.
The same is true for protection from energy and similar spells.
Obtaining long-term resistance to the other elements is made through persistent spells applied to the low level protection spells you already know (whether applicable) or through multiple castings (with pearls of power or similar items) of the same low level spell many times per day.