Usually you're attacked when other races view you as "hostile". You can change that by reducing the number of "-" or "--" in the foreign policy screen. Well, that's not always easy as outspoken because different races react *different* to the same matters, e.g. Drengin view a high diplomacy rating as negative while most others do not.
Best way to manipulate the relations is with Freighters. And also try to avoid some grave mistakes as positioning Military vessels (esp. Troop Transports) near enemy planets. Don't break treaties, and always help your allies.
If you go for Influence/Tech it would be a good idea to persuade your neighbours with all means into an alliance, probably sending all Freighters to one until he's allied, then re-routing the Freighters to the next.
Try to have a balanced/good military. However, if you are too strong it could be that several good AI's declare war unitedly upon you (probably a result of the Drath's SuperAbility)
Building Influencer Bases almost always give you a penalty or two - I'd do that only if I don't have to fear the AI (because he's too weak, or an ally). One problem is that during a war enemy planets don't flip.
There are actually alot of things you can do to better your diplo relations (e.g. gifting worthless Techs as Sensors) but you'll surely find out on your own over time.

