Re: 40 hp outboard slips out of gear
Gearcases do not slip out of gear then back in again without causing serious damage to the engagement dogs, you would hear or feel the chattering if it did.
I suspect that the rubber hub in the prop is done, slipping under a lot of power, regaining traction when the power is reduced. Sort of like spinning a tire on a car with poor traction, gentle use and the tire will hold, gas it and you just spin.
Prove it by drawing a line across the rear of the prop hub, use a sharpie/marker and make a line from the outermost edge all across the center/net to the other outer edge. Run the boat and throttle it hard til it 'revs' in gear. Pull the boat and look to see if your 'line' is still one neat straight line.
I'll bet it is not, the rubber hub is slipping. Remove the prop and take it to your local prop shop, they can press out the hub and press in a new one for a reasonable cost. Depending on the prop you may cost compare the price against a replacement prop, or consider investing in a 'spare' prop. Having a spare prop can save a wasted weekend on the water.