Mine does this exact same thing and it annoys the carp out of me. My fix was a really easy one that illiterates that these guys are not the most intelligent. So, as you know the gap is only wide enough for them to wedge their faces in on one side, so I cut a black towel to fit over that half of the cage and at night when he starts getting restless, I hang it over that side of the cage. He immediately stops trying to wedge his face and moves to the other window where he can't do that. I call it his curtain. It like some tiny part of his brain goes "oh, wall" and he moves over. I've checked and checked, even left the last 1/4 inch exposed so I could watch, but when the curtain falls he stops wedging his face. I don't know why, but it works.