Because the planet is a sphere, with no irregular 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 sun). 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 texture is 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:
(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:
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..
or, in other circumstances, you could constrain the Empty to point its X at the sun.