In my experience. If an attacker has a balanced fleet there is nothing your planet can do to save itself fast. Otherwise the only defenses I can think of are.
Spending a lot of time/effort to fortify the planet. This is not very pratical on a large scale and you are better off building ships generally.
If you have the tech. Build a star destroyer in each of your systems. Blamm his fleet and your planets at the same time. You were going to lose them anyway.
Give the planet to someone that is allied to both of you. If you die at least you have helped someone else and some of your population may live till the end. If things change you might get the planets back from the person you gave it to. Think of it as the planet asking for sanctuary from a neighboring neutral empire. They pledge to stay out of the conflict and support their protectors.
