Normally you can predict where the pirates are going to strike. It'll be at the planet that's the closest to the pirate base. Sometimes it can be hard to tell which planet this is, which can get a little frustrating, but Anderson pretty much got it. Put a cap ship there with a repair bay or two and some turrets. You don't need to leave too much behind, because pirate units compared to other tec/advent/vasari units are about 1/2 the toughness.
The biggest thing to worry about is the seige frigates, if you can take them out, the planet is pretty much safe. You may lose some buildings, but you'll never lose the planet.
Also, pirates will chase Colony frigates and trade ships first and foremost. Why? I don't know, but if they're in the grav well, the pirates will waste their time chasing them.