Overbooking is standard operating procedure for many airlines these days, especially among budget carriers which depend on tightly packed aircraft.
If your booking allows it, select your seat in advance. Airlines are less likely to dump a passenger with an assigned seat than one without.
Fly during an off-peak period. Commuter flights and those operating on busy days are more susceptible to overbooking, and the chance of being offloaded is commensurately greater.
Loyalty counts, and frequent flyers with points and status credits get preferential treatment when flights are full. Even flyers with zero points who are registered with an airline's frequent flyer program have an edge.
Show up early at the check-in desk. You can still be offloaded even with a boarding pass in your hand, but it's more likely to happen to passengers who arrive closer to flight time.
Airlines with more passengers than seats will sometimes ask for volunteers to delay their air travel in return for compensation. While this compensation might seem attractive, the payment is usually higher if you are offloaded involuntarily.
If that happens you may be entitled to compensation of up to $US1300 ($1845) in the case of a US flight plus a full refund of your confirmed reservation.
On flights originating in the EU compensation is in the range €250-€600 ($395 to $950), depending on the distance of the flight.