Designate a driver. While most people have heard this more than once, it is still the simplest, cheapest way to avoid getting behind the wheel after having a few drinks.
Call a taxi if you've had too much to drink. Most cities have some sort of service. Even if you drove to the bar, leaving your vehicle at the bar and going back for it the next day is less expensive than getting a DUI.
Walk home, if you are close. Although walking isn't an option for everyone, if you are within a couple of miles of your home, it could be your best bet if you had one too many drinks. Just make sure you stay in well-lit areas and on well-traveled streets. Walk home with a friend if you need to pass through unsavory areas.
Stay where you are. If you are going over to a friend's house for a party, consider packing an overnight bag just in case you can't drive home. Even if you weren't planning on drinking too much to drive, preparing ahead will make sure you don't get a DUI.
Buy your own Breathalyzer machine. Even though your personal machine may not be an exact match to a police officer's, it will still give you a starting point to base your decision on.