Scratching the bed maybe your dog's way of marking its territory and communicating to other dogs that it is their resting place.