So, in short, it starts ok, runs ok cold and hot but has no pwer after say 5 to 6 k revs.
The ignition advances ok.
When cold and hot??
When hot, with bike on centre stand and idleing in neutral, if you increase revs all is ok to about 6 k revs when misfiring/surging takes place?? More throttle opening just causes more misfiring and engine refuses to rev over 5 to 6 k revs ??
Connect your strobe timing light, with a clip over ht lead semsor ?
Does the stobe flash all ok up to the point where is misfires, then just goes crazy, stops flashing properly, with no flash when misfing??
Road test, red neon flashing plug caps are available and cost only a few $$, easy to fit and give a visual indication ( flash ) that HT is passing thru them. With these fitted for testing, on a safe staright bit of road ( up hill as well ) on a dark evening, do they stop flashing when the misfire happens ?? I assume yes they do.
Verdict, internal shorting out of the genny cdi charging /source coils, and/or failing cdi, and/or failing ht coil, and/or ig kill shorting/flashing/AC leak to earth. Pretty much the whole ignition system really.
Do you have any AC volts data from the wires from the genny, there is a list on here somewhere, see my and others threads on this matter. Not at home and memory of 400 genny wires a bit poor.
green is earth, light blue, dark blue, brown, white and one other, the colour of which escapes me at present, it may be pink. As a rule, AC output will rise with revs.
If AC volts drops from about 55 v AC at idle to about 25 volts AC at about 5k revs on the source/charging coil wires , the misfiring starts to happen. Seen this many times now.
Recheck all genny /cdi/coil connections and try with cdi black/white wire disconnected. This wire is earthed/grounded to kill ignition. If this disconnection cures the problem, then there is a fault either in the main loom, ign switch or handlebar kill switch, the latter being most likely.
You may have a HT coil/cdi fault also, not to mention fueling, but rule out ht first.
If you have a scope, or access to one, you are half way there.
PS does the bike vibrate a lot ?