Many of us often confuse these tropes (a trope is a word or expression used in a figurative sense). Here's an explanation of all three, along with examples.
A metaphor is a direct comparison between two or more seemingly unrelated subjects. A famous example presented by Wikipedia is Shakespeare's famous text:
All the world's a stage,
And all the men and women merely players
They have their exits and their entrances;
In this metaphor, the world is compared with a stage. Another example of a metaphor, given in the Merriam-Webster Collegiate dictionary, is the term drowning in money.
Beware of using "mixed metaphors." Patricia T. O'Conner, author of Woe Is I, writes in her section cutely titled "Metaphors Be with You" about mixed metaphors. "No clear picture emerges, just two dueling ideas... If you've heard it's unwise to mix metaphors, this is why: The competing images drown each other out, as in, the silver lining at the end of the tunnel, or don't count your chickens till the cows come home. Some people are so wild about metaphors that they can't resist using them in pairs. This may work, if the images don't clash: Frieda viewed her marriage as a tight ship, but Lorenzo was plotting a mutiny. Since the images of tight ship and mutiny have an idea in common (sailing), they blend into one picture. But usually when two figures of speech appear together, they aren't so compatible. In that case, the less said, the better."
A simile is a figure of speech comparing two unlike things that is often introduced by like or as. The dictionary's example is "cheeks like roses." Other examples are "sly as a fox," "old as dirt," and "an expression as cold as ice." A simile compares two items, a metaphor equates two items. The argument can be made that a simile is a type of metaphor, but that's for another day.
An analogy is an inference that if two or more things agree with one another in some respects they will probably agree in others. Examples include "shoe is to foot as tire is to wheel," "steering wheel is to a car as a board of directors is to a company," and "a sword is to a warrior as a pen is to a satirist." Think about these and you'll quickly understand how all analogies break down eventually.