It is not unusual for birds to masterbate in this manner. If
you try to stop the behavior, the bird will become frustrated
and can start with even worse behavior, ie; biting, etc. It
is best to just ignore it as best you can because denying your
bird affection (as some sites suggest) will only make the bird
feel rejected and can likewise bring on even worse behavior.
Limiting certain types of contact when the bird is in breeding
mode is okay, but don't abruptly stop all contact. His
behavior is natural and normal and those who want 'perfect
birds' who don't display basic natural behavior should buy
stuffed pets, so don't bother listening to them as if they
speak the gospel. If your bird is happy with the mouse, but
you need to use it, get him his own. Good luck.