It might be easier for me to analyse the situation if you had a specific hand situation here. Sometimes the problem is bet sizing. Other times the problem is not recognising when your opponent has the better hand. Sometimes the problem is in over-valuing your hand. A specific hand and action sequence helps to identify the problems. Otherwise the advice will be general and not too helpful. It makes a difference if the villain is earning a set due to one card on the board (harder to detect) vs. 2 cards on the board (easy to spot). Also it makes a difference if your 2-pair involves a pocket pair with another on the board (weaker), or a hand with one member of each pair in hand with the others on the board (stronger). Another clue lies in the bet pattern and bet sizing. All of these help to identify the situation. Some situations cannot be identified, but if you eliminate the ones where clues exist, you will see an increase in your earnings.