There are two types of buffing in D+D.
(1) Pre-combat buffing. These are the things you cast that will last your entire adventuring day. Access to such abilities doesn't really start until 3rd level or so, when you can get 3+ hours out of hour/level spells, and 3 hours is generally enough for most adventures (especially at low levels).
By 10th level, 10min/level abilities become pre-combat buffs, especially in combination with extend spell (or an extend stick). As extend sticks are cheap, its the recommended option. They can be used as such even earlier if you have forewarning of combat or expect combat in the near future. Even at 6th level a 10min/level spell lasts an hour.
(2) In-combat buffing. This is generally a mugs game, unless you seriously need to cast the spell that makes you immune to whatever your opponent is doing, or have everything on a quicken stick (re:rod) to not waste actual turns doing so. And seriously, if you have a quicken stick, you should probably be burning it throwing more offense at your opponent.
These spells have really short durations, but if you have some immediate forewarning (rogue comes back and tells you there's monsters up ahead or scry-and-die tactics) you can pile these on before charging around the corner/teleporting in.
Spells of this type that are often worth casting in combat include spells that give you a decisive mobility advantage (Expeditious Retreat at low levels, Fly or Greater Invisibility at mid levels, possibly Etherealness or Ghostform at high levels) and spells that provide blanket immunity to attack types (Protection from Evil for immunity to mind-affecting abilities, for example).
Wizards
Example #1 Type spells:
1hr/level
False Life
Mage Armor
Protection from Arrows
Greater Magic Weapon
Darkvision (should you not have it from racial abilities)
etc...
10min/level
Stoneskin
Magic Circle vs. X
etc...
Type 2 Spells:
Shield
Expeditious Retreat
(Greater) Invisibility
Fly
etc...
Abusing Buffs
Arcane casters have a few tricks for getting free long-lasting buffs out of otherwise short durations effects. Persistent spell is the logical culprit, but the spell level adjustment is hard to swallow. Which is where Metamagic Effect comes in (courtesy of Incantatrix). Free metamagic applied after you cast the spell for a spellcraft check you're going to make, because you invest in it.
Divine casters have access to Divine Metamagic, which with a healthy load of turning attempts (acquired via nightsticks of course) can give you loads of freely persisted spells.
Playing a buffer
Buffing is not a stand alone strategy for arcane casters. The point of arcane buffs is to make adventuring life vastly more survivable than it would be otherwise. You'll want to compliment this with an offensive option, like save-or-lose spells.
For clerics, buffing makes them credible combat threats and can improve the combat performance of most of the party. Quicken Spell is incredibly useful here as you'll want to be taking your attacks as well as getting off spells like Prayer or Righteous Wrath of the Faithful (i think i have that name right), Quicken Sticks or Divine Metamagic:Quicken are solid choices.
Clerics also benefit a lot from GMW and MV, which let them spend vastly less gold on their armor and weapons than otherwise. And with persistible buffs like Divine Power and Righteous Might, an optimized buffer cleric outperforms most melee builds with full casting power. Buffing is a way of life for a cleric, and a very good one.
Buying Time to Buff
In case the party gets caught with its pants down and really needs time to buff, there are some options. Prismatic Sphere or Wall, Wall of Force, Wall of Stone (and possibly iron, although its not actually as useful), are all quite useful in this regard. Leomund's Tiny Hut can be useful, especially against an opponent who wanted or needs to use ranged attacks (see also, Wind Wall). Many spells can also seriously delay opponents, buying you time (although buffing may not be your best use of that time), such as Solid Fog, Black Tentacles, Web, or even Grease. And a clever Illusion can possibly accomplish any of these goals, and Invisibility Sphere can hide your entire party.
Simple movement spells can let one character stay away from creatures lacking those movement modes (or slower at them), and thus buy time to buff, but this doesn't help the party, just the enabled character. Spells like Greater Invisibility also fit here. Timestop similarly lets you buff yourself. Or you can just planeshift yourself to a plane where time flows so fast a whole day passes in a fraction of a round, rememorize spells, cast buffs, planeshift back, and you can teleport to where the battle is before the next round ends. But that's just silly.
Of course, the best way to buy time to buff is to be forewarned about what challenges you'll be facing. This ranges from everything to a Gather Information check to divination spells the day before. Clever players with access to sufficiently awesome divination spells should have a pretty good idea of what they'll end up facing, approximately where they'll face it, and can plan appropriately.