Because the planet is a sphere, with no self-shadowing, you can use a simple mask, in another object's space.

In this example, the planet is at the global origin, rotating about Z. Its diameter is 2 units. The sun is down positive X.

Add an Empty at the center of the planet. (Its local positive X points toward the light). It will not rotate, while the planet does, and the mask between emissive and invisible lights will be in the empty's Object Space, not moving.

The Lights are in the planet's Object Space, and turn with the planet.

A simple Black/White transition is made by a Color Ramp, down the X of the empty, and centered on it, to make the mask.  Dimensions may have to be changed, depending on your model.

So the tree is something like this:

 [![enter image description here][1]][1]

(You will obviously be using your own textures, not procedural lights, as shown here, so those nodes don't matter)

With this sort of result:

[![enter image description here][2]][2]

If you're animating the planet going round the sun, you could parent the Empty to the sun, and the mask will stay pointing in the right direction.


  [1]: https://i.sstatic.net/DuZtk.jpg
  [2]: https://i.sstatic.net/HqQyx.gif