Using needle-nosed pliers, I would carefully make a slight downward bend in each of the terminals, forcing contact with the terminals inside the cord. That would also wedge the plug towards the bottom of the receptacle, keeping it tight. If it still loses contact, try bending them upwards instead. Also, find a new cord, because loose contact has probably caused arcing and burning of the brass terminals inside the old cord. And clean the terminals in the power supply with alcohol, or an emery board if arcing is visible (that top terminal looks slightly burnt).