The various distinctions and differences between a duke, lord, sir, earl, baron, baronet, and prince were drawn long ago, but still hold true today.
Here they are in order from top to bottom:
Baron is the lowest rank of the upper classes, having earned this title by faithful duty to the king or feudal lord, usually in the form of military service.
A baronet is the highest-ranking class that can be bestowed upon a mere commoner like you or me. This title is also usually earned through faithful service to rulers.
A lord, generally, is any of the above who get a title and property by hereditary right or by being born into the right family. “Sir” is simply the title used when addressing a knight or a baronet.
Often, some hereditary titleholders will hold other titles as well.
For instance, the eldest son of the king or queen of England, aside from being a prince, is also automatically the Duke of Cornwall, no questions asked.