First of all, and just to be on the safe side, I would run Anti Malwarebytes Malwarebytes : Free anti-malware, anti-virus and spyware removal download
Quick scan on that just to make sure its not anything malicious..
The mouse sounds like a fairly common problem. If its a laser mouse, make sure there is nothing blocking the receptor on the mouse to the surface. Also, try a few different surfaces (make sure they are flat, clean surface) I.E. My old mouse functioned very poorly on a mouse mat, but a lot better on a sheet of paper, or just the desk.
If you have a roller ball mouse, take the roller ball out, and clean the little (usually black) rollers inside. (You can use your nails, or something sharper as long as you are relatively careful) Theres usually a build up of dust and dirt around the centre of the rollers, that can cause lots of problems. This is probably the case, especially if your mouse has been fine, and has only recently started to play up.
Definately seems a power to the keyboard issue, if you are moving it and the lights are going on and off. It's not a 'common' keyboard problem, as keyboards are pretty robust. It sounds a problem with the wire with the keyboard at some point, but just try the kayboard in another port, to see if you have any problems then.
Theres not much you can do to repair it yourself - The cost of a new keyboard is pretty much nothing now a days, and almost every standard keyboard should be compatible with your machine (just check the connection type.. E.G USB etc), it would probably be more cost effective to buy a new keyboard than send it for repair.