A few tips on defenses:
1) Always build your military/forts/towers just behind your cities, not in front.
2) Build watch towers by shooty buildings (towers/forts)
3) Spies can really save you in defence, taking the siege away.
4) Garrison troops in defence, especially if out numbered, keeps them safe while you build up and adds to the attack of towers/cities etc.
5) In fact always garrison your troops when not in use, hides their numbers and keeps them safe from poaching spies.
6) Troops in the open should always be under a general, entrench everything and decoy everything.
7) Always have a scout with your army.
8) Build cities behind natural terrain like forests and mountains. Cities can't be destroyed so downt worry about him pounding on them if he can't get his troops there to capture it.
9) Rivers own. Put your cities a few tiles behind a river so any sieging force has to sit in the river bed. Slaughter at will.
10)Put various infantry on rocks, they get a defensive bonus (hover over the rock terrain with your mouse for details)
11) Keep cavalry separate and to one side, wait for battle to be joined then smash them into the flanks and rear for devastation 12) Build a few (don't go mad) towers to protect your key resource gatherers from raiders. Don't put them on borders as a defence, this is an offensive tactic. Defensive towers are just target practice.