Just like buying jeans that fit well, you must take measurements to obtain a well-fitting hat. By doing this, you ensure you order a hat that will fit snugly, but not tightly. It also won't drop too low on your forehead and hide your eyes.
Using a tape measure, measure the circumference of your head at the center of your forehead. Depending on what the hat material is, it will expand with heat. Worn for a long time, your hat will loosen. This means you will need to add a headband on the interior to get it to fit snugly again.
A straw cowboy hat remains snug in fit better than a felt cowboy hat. Felt hats stay on better though and are less apt to fly off in windy conditions.