Small squads, short walking distance for food / drink / sleep, doublechecking that assigned equipment is actually being worn, and picking your battles.
The last encompasses a couple of different things.
1. Don't charge archers*. Either let the marksdwarves fire from behind fortifications, or wait for the squad around a corner (add covering fire here too). Once a goblin squad makes the decision to path into the fortress, the squad leader will come towards the front and be one of the first to get a faceful of bolts or swords.
2. Don't allow dwarves free line of sight. Any individual dwarf that sees an enemy will charge heedlessly, regardless of how many enemies there are and how few other dwarves are ready. Gather your forces somewhere close to the battlefield but out of sight, and once they're all there you make the move order.
3. Use move orders instead of kill orders. A group of dwarves ordered to kill an enemy will always chase it down, but a group of dwarves ordered to stay in one place will do so once they're out of engagement range. Limiting LOS is important when enemies are withdrawing too -- if the remnants of a goblin squad are fleeing, chasing them down is a waste of energy and draws your dwarves out of their nice little murderzone. I don't use the 'protect burrow' order, so I don't know how aggressive dwarves will be about catching enemies.
4. Make every entrance to your fortress a good place for your soldiers and a bad place for your enemies. Set things up so that the only ranged combatants getting a clear shot are your marksdwarves (and the inevitable Elite enemy), and so that groups of enemies don't see your melee fighters until they're right on top of the massed force.
The bottom line is that both goblin and dwarf AI are a bit brainless, but only the dwarves have an intelligent mind guiding them. Take away the dwarves' ability to act on the more suicidal ideas their AI gives them, and they'll preserve themselves a bit better.
*Dwarves who are suitably badass can attack a squad of bowgoblins on open ground like they're not firing anything, but it's not a good idea if they're less than Legendary at dodging, parrying, and blocking. If they're not quite badass enough, you're down a moderately badass dwarf plus all the time you spent training them plus the teaching skill that they had.