Earnest money is a way of getting a sellers attention. If you can afford a large one, up to 5% you demonstrate a serious intent to buy the home. If there are competitive bids, this may allow you to beat out another bidder. If you don't have a large earnest money available, do what you can but realize this is a measure of intent.
One consideration I make for my sellers is the earnest money enough to cover their costs while we are off the market with this offer. If it's a 30 day close, I like to see at least a one month months worth of mortgage payment.
In my 10 years in Real Estate I've never had a buyer or seller lose their earnest money. It can happen, but if you know the terms of your contract, and you are sincere in your intent you shouldn't be too concerned. Ask your agent to explain what your contingencies are and the dates associated with them, so you can both keep track.