Sometimes your opponent is just better than you. This does not mean that you cannot win the match. As a matter of fact, it is likely that you have beaten better players if you have played a lot of matches.
This is one of the great things about tennis. One of the measures of how good you really are is your ability to win matches against all kinds of players over a period of time. The losses matter but the wins actually say more about how good you are. My advice when facing a player that you recognize to be better is to play within yourself.
This means you should realize what you do well and keep trying to put yourself in the situation that allows you to do it. Hit your normal shots and play your normal game. Of course, a better player will make you feel like you have to play at a higher level, hitting great shots to win the point-don't think like that! Be very good with the percentages at the beginning of the point. Make a lot of first serves and a lot of returns. Force your opponent to win the point with shots other than their serve and return of serve.
If you serve and return better than your opponent, you may be able to control more of the points and get them to play outside their comfort zone. They have matches where they struggle just like you. I have beaten a lot of players who were better than me and you can do this as well!