Sometimes, pokémon simply react to the things they dream about through physical movement. For example, a meowth may twitch its hind legs because it’s dreaming about a catch, a growlithe may roll over and whine because they’re dreaming about receiving affection from their owners, and pokémon that can extend spikes (such as quilfish or togedemaru) may do so in response to a nightmare. The latter sounds like it may be the case with your togedemaru, particularly given the fact that you’ve mentioned he cries when you wake him. (Alternatively, if you touched him to wake him up, he may be startled. If that’s the case, try to avoid touching him to wake him in the future.)
If your togedemaru is experiencing nightmares, there are a couple of things you can do to limit their occurrence. For one, keep in mind that nightmares are often the result of stress or anxiety in one’s waking life, so if your togedemaru seems particularly stressed out during the day, try removing the source of the stressor. Reduce the intensity of your training regimen. Ensure your togedemaru’s environment is comfortable. If you have an important battle coming up, do your best to reassure him that he’ll be fine and consider adding meditation exercises to your training routine. In fact, you may wish to add meditation exercises to your routine anyway, as this will help reduce your togedemaru’s daily stress levels.
Also, be sure that your togedemaru is getting enough sleep at night, and avoid allowing him to eat before bed. Sleep deprivation can actually cause nightmares by increasing stress levels during the day, and eating before bed (especially eating certain foods, such as sugary berries) may cause digestive upset during sleep, which will of course affect his dreams. Practicing good hygiene in general also contributes to the level of comfort your togedemaru experiences during sleep.
If none of this helps, there are licensed Nurse Joys out there who may offer your pokémon some psychological counseling. It may be worth it to ask your local Nurse Joy for help.
Best of luck, anonymous!