I had this very annoying problem and just accidentally fixed it.
I was trying to clean the slots on the underside of the screen and I popped off the plate that surrounds them. I noticed that there was crud under the plate so I cleaned it out and, low and behold, 2 tiny magnets appeared under the crud.
After cleaning them I put the plate back on and the problem is totally gone.
Apparently the surfacebook uses those magnets to know its attached and if enough crud gets in the way they stop working reliably.