It seems very unlikely that our bodies would 'know' when to sleep based on the earth's, moon's and sun's magnetic fields, since there is simply NO consistency in their joint positions!
That is to say: the time it takes the moon to orbit the earth one single time does not correspond to an exact number of days (= a single orbit of the earth around its own axis). And neither does the moon orbit the earth an exact number of times in a single year (= a single orbit of the earth around the sun). Consequently your theory should -if anything- predict that the optimal sleeping times would constantly shift, day by day, month by month, year by year. (Just like for example the time of the day we see a full moon shifts each month.)