A few options I could suggest;
1. Weights: if the mouse is light or such sometimes it can be easy to pick it up, and causing your problem, however it could take a slight adjustment period. But if it solves your problem, great!
2. Mouse positioning: Now this one can kind of be tricky, but if your mouse is an awkward spot or in a place you're having this issue, try moving your mouse completely around your desk until this problem doesn't occur, and again there will be a more labor intensive option, but I've seen it work.
3. A mouse with a high lift off sensor: Mine has a customization option to where I can set how harsh the lift off is, some people don't have that option, nor have I toyed with it, but again I have seen it fix some people's problem before.
4. Mouse sensitivity: This one is probably the most labor intensive option if your problem becomes so unbearable it might be worth investing in, but switch your mouse sensitivity to something more sensitive, so you don't have to move your hand/wrist so much, which is usually the problem in this case. There is usually a really big adjustment period if you go with this option depending on sensitivity adjustment. DPI is usually the best adjustment, but Osu has it's own adjuster in the settings tab. Again this can be really tricky to fine tune and if you can fix it otherwise it's usually easier.
5. Hand positioning: If your hand position is light or resting it can slip or you can pick it up, causing connection loss. Try changing it up, or just buying/using a new mouse completely, the ergonomics can really make or break the mouse sometimes.
6. If all else fails, try a decent mouse pad and re-train yourself to play with mouse and avoid lifting it up. This seems like a really obvious solution, but if nothing else is working or you're out of options, sometimes it can be user error and the only option left.