A friend did this recently on a bigger scale. Long story short, his old Yam 225 V6 2T needed a gearbox. Seller on auction site listed a gearbox for sale saying fits his engine. Turned out on delivery it was from a much newer 4t. The bolt holes lined up but it was about an inch nearly longer at rearmost point. As yet untested and perhaps maybe suspect it may not be ideal at its internal interfaces. Soon see. Doesn’t look great.
With yours, I honestly don’t know but generally the 4 strokes these days have larger gearcases at a glance. Another perhaps possibility may be that some new 9.9 Yamaha’s are high thrust models for kicker auxiliary use. These certainly have a larger gearbox I’m sure.
I would imagine the ratios may be different too.