You can change a race's "opinion" of you by giving them things like cash, ships, or tech's. If you start to see some race dropping below neutral in relations with you, it is usually only just a matter of time before they go to hostile in relations and then to war with you.
I try to keep the AI races at friendly with me whenever possible. I find that giving tech's (2 or 3 at a time seems to work well) will generally move them up one or two places in relations.
Experiment with it and devise a way to incorporate "tech whoring" as a strategy you can use prolifically.
HINT: Remember that other races will trade amongst themselves irrespective of what you do. Therefore, wisely select the tech's you will trade, and trade them for as much as you can with every race you have made contact with on the same turn. That way you'll be able to see the maximum benefit from the research you have done.