Is there a difference in meaning between somnoler and sommeiller and when should I use one and when other?
You can get a lot of descriptions from the Trésor de la langue française informatisé. Somnoler and sommeiller can be used as synonyms in some contexts, especially talking about inanimate beings (a town). There are however a few subtle differences. Substantives sommeil and somnolence indeed have different meanings.
I will restrict to human beings, and try to highlight when the meanings differ.
Old meanings for sommeiller include sleep, and death. It now denotes a shallow sleep, possibly short, either close to awakening or falling asleep. Or an inactive, passive state.
Somnoler, to what I understand and use, is closer to half-sleep, meaning partly awake, partly sleepy. You may use somnoler when you are doing something, and gently falling asleep (chosen examples for TLF: "être temporairement inutilisé", "s'engourdir", "s'endormir en faisant quelque chose".).
For instance, I would say:
- le conducteur somnolait au volant (en roulant),
- le conducteur sommeillait au volant de sa voiture (à l'arrêt).
One talks about "somnolence au volant". While not a proof, the expression "sommeille au volant" seems much less frequent with a common search engine than "somnole au volant".
To make it short, sommeiller often denotes a steady state, somewhere between the state of sleep and wake. While somnoler is more evolutive (slowly oscillating between wake and sleep), or denotes a temporary state or situation. Sommeiller can be short or shallow, but somnoler is more intermittent.
In France, no one use "sommeiller", you have to use "somnoler" when you are about to sleep.