You need to let your bird know early on, with LOVE & CONSISTENCY, that YOU are the boss. I don't mean you are to bully him, just be strong, don't show any fear of getting bit. Be confident and not wishy washy, you can let him know with love and tlc that you expect him to do what is in his best interest, sleep is one of those things.
All of us here on this forum have at times been bitten, some more than others. I have 2 greys and an amazon. Bites on our hands and fingers when they don't want to go to bed are common in my house, BUT......I never let their bite change the intention I have of putting them to bed. As Judy said, it can take 100 times and then some....I lost count after 39....