Hello Michael
What you describe, I have experince a few times.
You give full throttle, and when you get up a few hundred feet the engine starts to go bad and a moment later to run well again. What most likely happens is that an exhaust valve starts to jam. If you use a lot of 100LL, the lead deposits can cause this problem. You can get rid of some of the lead deposits if you cruise over 5000rpm. The problem can also occur even if you use unleaded fuel, but then primarily due to excessive heat.
If the cylinder heads and valves dont have any abnormal level of ash deposits and if you use unleaded fuel, most indications are that the engine runs with a lean mixture. You can raise the throttle needles a notch and try, that will lower the exhaust temperature. What you will notice is that the engine consumes a little bit more fuel per hour, now you can see if the problems goes away. If the problem still occur, the cylinder heads most likely should be disassembled, cleaned and checked.
Regards Roger from Sweden