There are three types of situations. 1) the opponent has about the same rating and strength as you. 2) the opponent is weaker rated and has lower strength than you. 3) the opponent is higher rated and has more strength than you. To have a strong focus during the game, you need to be motivated to show class and play good chess. In the situations 1 and 3, the motivation is pretty high. In situation 3, you can get nervous, because the opponent could be much higher rated and you start thinking that every move they make is golden. While in situation 2, your level of motivation could sink, and your focus could become low, because you think that the victory is easy to get.
Wait. But the higher rated also has three situations. And you are situation 2 for the player who is situation 3 for you. So if the higher rated player beats you, it means that they somehow have a high level of motivation when they play against you. How? One motivation is to keep their rating. Another motivation is to beat you out of principle. Another motivation is to show high class on the board.
Just winning is probably not enough as a motivation. You play more focused when playing for gold medal in a team championship than you play during a blitz game in the park. So if you notice that your level of play is varying, don't worry, probably it is your motivation that is varying. For example if you are thinking about other things and you are tired after work, you cannot expect to play great chess.
Unless you have strong nerves! The circle is complete. Strong nerves is the key. Block everything else out. Focus on your ideas and make your moves. Follow simple and great plans. Remember everything you learned. Fight for the key squares on the board. And win the game. The three situations, perhaps they need different ways of approach. But maybe not. After all the goal is to win the game no matter who the opponent is. The goal is to focus on your game and not on your opponent.