Learn to respect a sleeping animal. You can't just go and disturb them just because you want to cuddle them. If you try to kiss or cuddle them when they are sleeping, it is their natural reflex to attack. If some dogs attack without being touched also it could be because of fear or because they are territorial.
Crate training is the best option and if that is not possible then always wake up the dog before you enter the room. Start talking before approaching the door so that they know someone is coming.