If you have time to spare, use malwarebytes. A reformat however would be your best bet.
If you dont have time to spare, use the safest device you can get your hands on (id suggest iPhone, Windows Phone or android which doesnt have any apps outside playstore installed) and change the passwords of your accounts as soon as possible (using the safe device). In the meantime avoid phishing. Do this by always checking where you enter your passwords (make sure it is instagram.com and not intsagram.com or sth like this), make sure the site you are entering your password has HTTPS, avoid suspicious emails (Example: Unauthorised access to your email, click here to change password)
Make sure that your emails are linked to a phone number and a security question set up, so even if you get hacked, you have a way to get them back.
Give your friend a black eye as soon as you see him.
Anything i missed?