Yes it's good to sleep with socks on.
When you sleep with sock on the socks helps your body thermoregulate while you sleep and this staves off night sweats and and hot flashes.
The socks also help keep your feet warm during winter months when the house may be cooler.
You lose a lot of body heat through your feet and head so by keeping socks on at night when you sleep you keep more of your body heat in where it belongs to keep you warm.
In the winter time I always sleep with socks on because I get cold feet otherwise and feel uncomfortable.
In the summertime it's usually too hot for me to sleep with socks on so during the summertime I sleep without socks on even though my house has air conditioning it's still uncomfortable for me to sleep with socks on.
There's nothing wrong with sleeping with socks or without socks and you should do whatever makes you comfortable.