Difficult to do.. but find a realtor that you can trust...
Remember the realtor works for YOU (or is supposed to.. again.. see point above.. find one you can TRUST).... The seller, the builder (if buying new), etc.. all work in support of someone elses interests..
Get pre-approved for a home loan... this will give you a bit of leverage when you get ready to make an offer.. and will also let you know what your limits are...
Learn patience.. DO NOT buy the first thing you see.. DO NOT expect the transaction to go smoothly (something always gets hinky when buying a home)... DO NOT expect the transaction to go quickly (many, if not most home loans take longer to process than you will originally be told by your lender)..
Figure out in advance whats important to you (what part of town you want to live in, what amenities you want in the house, what your price range is, school districts, etc..etc..etc.. ).. send your agent out armed with as much information as you can possibly give him/her.. be specific about anything that you can be.. help them weed out all the "no" houses in advance for you...
Consider building/buying new... I've had a lot of success in walking into equity when buying new.. builders are typically motivated to get rid of houses quickly once they are complete.. for them its a business.. they need to turn the house, make a little bit of money, and move on to the next build... they are not emotionally attached, wont find "value" in things that dont actually have value, etc... and every day that house sits on the market unsold is another day they are carrying a loan on the books and not making a profit on their work... It may take a little longer while you wait on a house to get built.. but if you play your cards right you can walk into a money maker.. and also get the benefit of getting to pick out all of your colors, light fixtures, etc.. make minor modifications to the design to suit your needs/wants, etc.. and not have the hassle of having to start changing/fixing things right after you move in..
be prepared to walk away at any time... its a business transaction.. not a marriage.. you owe nothing to no one (to include your agent).. do not get wrapped up in absolutely having to have a particular house.. if you cant get the right price.. the right terms... on the right schedule.. etc..etc... then do not make the deal... let everyone know that you are a man of your word, and intend on adhering to any agreement made.. but that you expect them to adhere to their agreements as well, or you will walk.. and find another realtor/seller/builder/lender/whatever... if you let people screw with you, or not uphold their end of the bargain.. they will walk all over you... this is a huge decision.. make sure its right FOR YOU.. hold these other people accountable.. and make them do their jobs... youre going to be paying a lot of money in fees, commissions, interest, etc.. everybody from the agent to the bank has a lot at stake.. make them earn their pay.. do not let them take it from you without delivering a product worth the price you are paying..