I think it is OCD.Deep seated mental grief,emotional problems triggers this.Consult psychologist for counselling sessions,by psychological therapy it is cured.
Health Tips
for overall health
1.sleep 8 hrs at night.
2.avoid too much social media.
3.avoid too much use of mobile pc laptop.
4.avoid mobile pc 1hr before sleep.
5.before sleep may hear good music,or read a good book or can watch a good movie.
6.workout daily or regular morning walk or join gym.
7.Share ur thoughts with ur parents or good friends.
8.Concentrate on ur work,study,passion, hobby.
9.Maintain proper diet.
10.Take proper protein supplement and some time multivitamines.