When it's time to sleep, you should try to have a bedroom that is totally dark. Total darkness can increase your melatonin production which can lead to better sleep.
Often times the problem is not light that comes in from the window, but light that originates within the bedroom, such as a night light.
A nightlight in your bedroom can be a friend and a foe. A nightlight can, of course, help you to see if you get out of bed so that you won't stub your toe, hit your face into the wall, or fall down. However, when you are lying in bed, its light serves no purpose except to make sleep more difficult for you.
But there is a solution: a motion sensor nightlight. Put one in your bedroom where you typically walk at night, and it will automatically go on upon sensing your motion, stay on long enough for you to do what you need to do, and then go off allowing you to sleep in darkness.