I've been asked about how to control being a medium so I decided to share my own experience.
first if you wonder why spirits try to contact you, it may have several reasons. They may need help, some want to contact others and use you as a bridge, some get attracted by your energy and some simply want to show their existence. but some evil spirits may just want to cause some disasters.
although from a very young age I've been having paranormal experiences, yet I was scared of spirits. I couldn't get used to it and in each experience I recall hearing my heartbeat. and also because of being weak, I could easily go into trance and had no control over it. it always made me wonder what if I hurt someone while in trance? so I decided to first understand the reasons which blocked my will power.
The most important factor in this situation is 'Fear'. Fear will weaken your will power and hold you back from taking the controls. and to overcome this factor, you should face what is causing you this. I myself, instead of resisting and trying to get the control, let it go with the flow. I let them do what they were trying to do. contacted them and 'see' them. seeing means understanding them. 'to gain control is to release control'. don't force anything. there is a reason which they are trying to contact you so don't fear them. know that if you understand what being a medium is, you can always contact them without any harm. and if you ask them with the power of will to leave you and simply showing its your area and they cannot stay there, they will leave.
Now for contacting; You can either try talking to them through mind's eye or 'Third Eye' or use an Ouija board. I do not recommend using Ouija board though it can have less dangers when the precautions are taken. But since it opens a 'gate', if you do not pay much attention, evil spirits will use that gate as well. so always be careful when using Ouija board. and never do it alone. its pretty dangerous.
For evil spirits there are lots of thing. you can either banish them or put salt in your room, bless your house or put some stones which absorb negative energy.
And the very last thing, spirits are not something to mess up with. respect them and they will respect you back. wish it can be helpful :)