Open the mouse and check whih part of the cord is loose. If its a plastic cord whih is loose u can try some kind of glue, or silicon. If the mouse disconnects becouse the cord doesnt contact I would suggest You solder it. But thats only if ur guarantee expired

If it wont help I'd say R.I.P old mx518 welcome new one