Back to OP, what stage of the game are you having trouble with? Early game, you might want to work on how you lay out the "trap" around your enemy wormholes --- for me, that means enough tractors to hold about 120% of a normal wave (some are going to get shot down) plus a mix of mostly normal/flak/laser turrets but backed up by a few longer-range turrets, hopefully placed to hit two or three wormholes. Usually at least one row of mines as well. I try to have enough that I can leave, say, half a cap of Mk I cruisers on FRD and have them mop up a standard wave with minimal losses. With advanced warp sensors you can build traps only when you need them and move the defending fleet ships around to meet incoming waves. Forcefield over the command center/wormhole toward your homeworld also helps a lot, with military command centers for especially tough world to defend. I rarely unlock any defensive structures early game.
If your trouble is more mid-to-late game, you'll likely need some unlocks, but you might also want to look into how you manage where attacks are coming from too. There is a *lot* of information here on the fora and on the Wiki about using gate raiding to set up "whipping boys," massively defended worlds that take the brunt of the AI's attack. In many of my games I wind up building a core that only has one or two worlds bordering warp gates, funneling attacks into a fortress world with dozens of turrets, defending ships, martyrs (for emergencies), waves of mines, and sometimes two-three fortresses --- of course, you have to have decent luck with the map layout for this to work, and during CPAs the AI doesn't need warp gates to attack you. Then I'll leapfrog into the galaxy, creating some lightly-defended forward posts that I'm willing to replace occasionally.
In general, though, for defensive unlocks I follow a rule Keith posted some time ago --- focus on offense most of the time, and wait til you get in trouble with defense to unlock defensive units. I find I most often unlock force field IIs or hardened force field Is (just for the extra cap when I have too many wormholes to defend), turret IIs, and spider and gravity turrets.