-Give gifts (+20 GPT early on does wonders. Thanks
@John.B.C !) You get a +35 trade modifier which would override the -25 from Territorial Disputes early on..
-Trade. This reinforces the same trade modifier that gifts do. If you're ahead, AIs will be less likely to attack because they can get science/culture from you.
-Spread Religion if you can. This gives a hefty positive modifier.
-Avoid actively pissing off powerful civs in the World Congress. Vote for proposals that are kind of irrelevant sometimes (the Natural Wonder proposal).
-Get to the middle of the pack, scientifically and culturally. If you're behind the pack, they'll attack you because they see you as weak, and if you're greatly ahead, they'll also attack (but this isn't as bad because you should be in the lead)
-Make sure that other civs are closer to your neighbours than you are. Sometimes settling a city 1 or 2 tiles back can make a fairly big difference.
-Militarily, you don't need to be on top. However, keep these things in mind:
-The AI considers your army relative to your empire size, so bigger empires need more military
-The AI considers your army to be a bit more powerful than it actually is. On Deity the AI considers your army twice as powerful as it actually is, on King it would be a little less (perhaps
@Gazebo could please shed some light on the AI perception of your army across difficulties) but still significant. Look at your neighbours size compared to yours and the difficulty you're playing and calculate a ratio where your perceived army is roughly the same)
-Finally, don't be so scared of war when it happens. Even if it's purely defensive, you will earn Generals, promote your troops, and force the AI to lose Production and Gold in lost units fighting you and you might just be able to snipe a city or pillage the AI to set it back. Find a defensive position, maybe plant a Citadel, be very careful
not to lose units, and you should be able to beat the AI back without letting them pour in. City-State allies and Defensive Pacts (or just joint wars) can help too.
-The alternative is to play aggressive. If you play Authority you'll get a ton of yields from war (Progress and Tradition can profit off war too!). Make a large army early on, promote it to Level 5+, and beat the AI at its own game.