It is definitely possible for you to scratch yourself while you are asleep, even without being aware that you are doing it. If this is becoming a persistent problem, you will want to see your primary care doctor
I say this because the most effective way to stop scratching yourself while asleep is to figure out what is making your skin itch and eliminating it. There are several distinct possibilities.
First, it is important to examine the skin for any signs of bug bites. In particular, if you have bed bugs, these may be coming out of the mattress at night and biting you, leading to itching and scratching.
Second, it is important to rule out any allergies or skin sensitivities. You could, for example, have a reaction to a new laundry detergent or soap. Similar, you could be allergic to mites or mold, or some other allergen that you are running in to in the bedroom.
Finally, atopic dermatitis, or eczema
, is a common chronic skin condition leading to itching and dryness.
Your primary care doctor will be able to consider all of these possibilities, as well as more rare serious medical causes of itching, and help you with a treatment plan.