It depends on your exact setup but here are a couple of things you can try which I arrived at from my own experience.
First of all, this is all aside the better in every way (except actual enjoyment of gameplay) of going wide/super wide. Assuming you are going tall, as I did in my first few playthroughs.
First of all, don't keep your units around the gate - keep them where they would defend best if/when you are attacked (I have discovered that AIs will highly respect "trenches" - if you fortify a position with a line of strong units (not permitting surrounding and forcing 1 on 1 fights) and artillery behind, thus maximizing firepower per tile, not only would you be able to defend easily against a swarm of similar/inferior units but the AI would not even try that hard to break it, just sending a couple of units from time to time and mostly using planes (I had a "war" going with 2 AIs for over 50 turns in which my units remained fortified and shot down upwards of a hundred jets in that time - 2-3 EVERY SINGLE TURN. Probably 5 units killed in that time. At the same time another AI was desperately trying to cross a channel into my territory guarded by 3 destroyers shooting down anything and everything that was embarked. The AI is stupid.)
Sorry, went on a tangent there. So just fortify positions as best you can, at a place right next to a city. Keep your armies there. Research phasal transporter (a.k.a. beaming technology). Proceed to send one unit at a time right from your front line to the gate. Thus you don't lose their defensive power prematurely but right at the last moment and only one unit per turn. You really should be producing only units at that point anyway as there is nothing else you need for victory but to survive! Of course, send in big units first if you can (and produce big units from your highest production cities). However, if you are really pressed and these big units can make a difference fighting, just send smaller ones. Sure, it will take longer but it is better than dying. Not every game will allow you to send in an Angel a turn...
Naval units are great for defending late game too, especially if you get the last upgrade. Get the perk that allows you to move after firing and the building quest that gives you +2 naval movement. THIS IS SIMPLY BROKEN. You can keep your naval units in complete safety (with intercepting aircraft in your border cities), move up, shoot at the enemy, pull back. This is quite literally free damage and the AI DOES NOT deal with it, at all.
TL;DR
1) Use phasal transporter so that you don't lose out on your units' strength before they actually go through the gate.
2) Fortify positions so that you can be cost efficient against the enemy. Don't attack into stuff, let them come to you (and fail miserably)!
3) Build the strongest units that you can - fewer stronger units are far superior to more but weaker units. Only once you have exhausted all your firaxite should you build anything but angel/sabr/cndr. Borrowing resources can be a great way to boost your army but only do that after the round of DoWs, as going in the negative should your benefactor declare war is REALLY bad.
4) If applicable, use naval units for free damage.
5) Forgot to write this before - tac nets on all front lines (careful not to block your phasal on top of your gate, though!).