When someone comes to ask your advice, your obligation is to give him the same advice you would need to hear if you were in his position. Focus only on the welfare of the person you are talking to, and not on any personal benefit you might derive from giving a particular type of advice. If you are unable to do this, then you should not be giving any advice at all!
The next time someone asks you for advice, view this person as yourself or as your beloved child. What is the absolutely best advice you could give?
Sources: see Rabbi Moshe Chaim Luzzatto; Path of the Just, ch. 11