have you tried to find out why it is happening. sometimes, it could be a result of too much screen time, if your child spends a lot of time watching TV or with other gadgets. it can affect eyesight and lead to headaches.
It could also be if your child is not getting enough sleep or good quality sleep. get an appointment with the doc to see what could be the reason, and the treatment too will happen accordingly.