HI L.,
Check her mattress and her bedding. It is extremely possible her body is trying to fight off something she is reacting to. With so many things made in China these days (and their lack of standards) many more neurotoxins are getting into our homes. Is there any synthetic latex in her mattress? Do her bedclothes have elastic? If you are not using a non toxic laundry detergent, it could be the same thing. Even things as "gentle" as Dreft have toxins that are simply less toxic than chlorine bleach but not good for little ones.
I don't know if this is the cause but it would eliminate one stimuli if not. The symptoms coming and going are almost too obvious for it not to have something to with this. Even if this is not the cause, it could be weakening her immune system so that she reacts more violently when she is in the bed.
Don't medicate her until you have determined this or not. Meds can weaken or contraindicate if they are not specifically called for in a situation. She needs her own defenses for whatever it is.
God bless,
M.