Hi; Sorry it;s taken so long to answer your question.
It really does sound like you have your hands full, don't despair all is not lost.
My first question would be, what was the dog's behaviour like with your friend? If it was acceptable then the dog needs to learn who is the master in your home. If the dog simply ran riot with his owner then it was unfair to ask you to look after the dog. Even the most highly trained dog will play up for humans that it sees as lower down in the pack.
All dogs need to know the ground rules but sadly they do not learn them overnight, it takes time, patience and committment. Another thing I would say is that a dog will mirror your mood, stressed human equals stressed dog, they do not speak english, respond to punishment or know what they are mean't to be doing without you showing them.
Start with the basics, create a calm environment and teach the dog to relax by doing simple training exercises followed by a reward. Repetition is the key here, this is how bonding takes place. We can't get into a full training program here but I and many others have written some very useful training hubs that might help.
Stay calm and keep at it, if this dog is trainable it will respond, if it has never been trained or trained to do what it likes then I would seriously consider asking your friend to make alternative arrangements unless you are an experienced dog trainer.