I am sure those of you who have played a lot of tennis matches have experienced losing to a lesser player, as well as winning against a better player. Tennis is like that--if you play enough matches you will have bad days and good days, and your results often reflect these different levels of play.
However, if you want to win more matches against better players, the first thing that needs to happen is to remind yourself that it is possible. Just as you have good and bad days, so does your opponent. In addition, tennis is designed to help the underdog or the person that is behind in the match. You can play a terrible set or play poorly for a period of time, but play well enough prior to, or after that, to win the match.
It’s also very possible to win a match when you are not having a great day. Hanging in there and focusing on the basics can take you a long way. Making more first serves, more returns, hitting two or three shots in a row on the majority of points, and finding the right combination of consistency and aggressiveness can give you what is needed to beat a better player. They may have to help you a little by not being at their best, or by getting frustrated because they recognize that they are the better player; this definitely happens.
Stick to the basics, play the best you can on as many points as possible, and believe you can win. You will eventually beat some of these players that are better than you and this will help make it happen more in the future.