Don't Let Fear of Metagaming Keep You From Playing The Game
When you have knowledge that your character doesn't, it can be frustrating. You'll often feel like you're helpless to deal with a challenge that would be trivial if your character just knew one stupid thing. If you're frustrated, you're not having fun, so the solution here isn't to just tamp down your out of character knowledge and keep being frustrated. The solution is to find ways to use your out-of-character knowledge in productive ways, without metagaming.
The Knowledge Gap Works Both Ways
Yes, players know things that their characters don't, but characters also know things that the players don't. You might be playing a rogue who knows all about poisons, even though you've never handled a chemical more dangerous than hard cider. Your friend might be playing a wizard, even though literally nobody at your table actually knows magic. Keeping this in mind will help you see yourself less as a video game player saddled with a dumb character to control, and more as a collaborator in a cool story who happens to have total influence over one of the characters.
Giving Advice
In your role as cool story collaborator, you can do more than just say what your guy does. When a character is supposed to know and be great at things that the character's player doesn't know about, that character's ideas can come from anybody sitting at the table, not just the person controlling them. Of course, the controlling player always has the final say on what their character actually does, but that doesn't mean you can't offer ideas.
Maybe your rogue doesn't know what a rock golem is weak against, but your friend's wizard might, and there's no reason you can't pass that info along to the wizard's player out of character so that the wizard can have the idea in character. By advising, brainstorming, or even just enjoying and commenting on the scene in progress, you'll feel less like your lack of in-character knowledge is keeping you from playing the game.
Dramatic Timing
As Jessa said, it's totally legitimate to use your out-of-character knowledge for the sake of telling a more compelling story. Everything you do at the gaming table should be about maximizing fun, not following rules just to follow rules. If trying really hard not to metagame is causing you stress and decreasing your fun, you either need to find a way to make it fun or bend the rule. You'll find that GMs will often bend the metagaming rule for the sake of drama. For example, if you spot a moment in a scene where it would be super dramatic for your character to enter, even though there's not a great reason for them to be there, you can definitely ask the GM if you can be there (or, depending on the system, just be there.)
Bottom Line
My personal feeling is that as long as you aren't using your out-of-character knowledge to gain a numerical advantage or undermine another player's agency, everything else is okay. When you're struggling with how or when to use your player-knowledge, try to think of the knowledge gap as increasing your options rather than decreasing them. Instead of thinking "man, there are all these things I can't do because my character wouldn't know to do them," say to yourself "okay, there are all these things my character can't do, but how can I use this knowledge?" Looking at the knowledge gap as a positive challenge rather than a negative impediment will help you generate more compelling moments with your friends, which is the real point of the whole metagaming rule anyway.