I hear ya
I went nuts with the same problem last summer for about 2 months on my 200 Yamaha, Saltwater Series (1994) engine.
Most of the so called Certified Yamaha mechanics I spoke with did not know how to fix it.
The cap on the oil tank on the engine, would pop up all the time when it was tilted up. The oil would spill out.
I tried putting a gasket on it, I replaced the whole sending unit ($$), and even considered changing the whole tank.
Then I found out what was causing it.
The main tank in the boat (the one you fill with that expensive YamaLube), well inside it there is a small pump to push the oil up to the engine tank.
For some reason, when there is a voltage drop to the engine or pump (I think it was below 11 volts) from either a low battery or a drain from the tilt motor, the pump in the main tank is somehow activated. It pushes oil up to the engine tank. (Yes even when the engine is shut off).
The the pressure pops open the cap.
For me the solution was to get a new battery for that engine.
To test, put the cap back down and drop the engine. Then with no other power source use the battery to tilt the engine up, and watch the cap for a few minutes (with oil rag in hand).
Be careful to not push down too hard on that cap when re-seating it.
Also be sure it is all the way down. There is usually a notch in the cap and if not aligned correctly the cap will not seat properly. The sensor will be out of line, and the oil level in the tank will stay elevated, and keep poping the lid.
The cap is actually the top of the oil level sending unit for that engine.
It has a screened in float that senses the oil level in the engine tank, and if you damage it or put in in wrong you can screw up your oil flow/engine.
Watch out for the small rubber gasket at the bottom of the sending unit that can be out of alignment. Be sure that the notched cap with the sending unit and lower gasket (about the size of a thumbnail) are in place and that the cap snaps down flush.
DO NOT FORCE, CLAMP OR OTHERWISE HOLD THAT CAP DOWN. It needs to be able to pop if the pressre in the tank is too high.
If the cap pops open when you do the test it is likely a low battery. Check your battery and put a charge on it, or replace. IF you can't do this with 100% confidence, then get a good Yamaha Tech to do it. Don't risk screwing up your oil system.
Good luck....