It could be pinworms or Ascaris larvaes, they have been reported to live in the head in the book "Animals Parasitic in Man"
I don't have a solution to completely get rid of them.
But i have a solution to decrease the load :
Tanacetum vulgare dry leaves and flowers powder in warm water
Artemisia absinthium dry leaves and flowers powder in warm water
If you try, please make sure to start by a low dose and a low concentration at first. For example one coffeespoon of powder in one cup of warm water. These plant parts can damage the liver and the nervous system.