In the United States, an attorney or "attorney-at-law" is a practitioner in a court of law who is legally qualified to prosecute and defend actions in court on the retainer of clients. The English word attorney has French origins, meaning “a person acting for another as an agent or deputy.” An attorney actually practices law in court whereas a lawyer may or may not practice law. Thus, a lawyer is simply someone who is learned about and has been trained in law. An attorney, on the other hand, has passed the bar exam and has been approved to practice law in his jurisdiction. Advocate is a more general term and simply means someone who supports or advocates for a person or a cause.
In Great Britain the terms barrister and solicitor are used to refer to lawyers and attorneys, but I'm not too familiar with the British legal system, so maybe a British member of italki can address the distinctions made in the UK between these terms.