Around 90% of the time when a laptop is not working properly, it’s because the power cord or connector has been messed with. Even if you cause a small tweak in any of the wires, plugs, or connections inside your laptop, this will have an effect on how well it runs – namely that without sufficient power from another source a laptop will just close down and go into sleep mode.
It could also be that something in your laptop actually broke or came loose and needs to be fixed by someone with more technical know-how than us average folks have. Let us know what you find out!.