Recently I sat on a Sony MDR XB400 Stereo Headphone. One side of the headphone popped out of the socket.
Below are the steps to fix the issue.
Wedge a screw driver below the silver cap and push to remove the silver cap.
A screw will be visible. Remove the screw.
Put the pieces apart
Wedge the screwdriver at the base of the holder to remove the cap.
Here is the cap is removed.
Once the cover is removed, slide the holder onto the headband.
Stick things back and screw it tightly.
Replace the silver cap back.
One thing to keep in mind is to keep the wires straight, you don’t want them looping.