Many parrots do this at bedtime because they are simply not ready to stop having fun. If she has a special treat she enjoys, save that only for bedtime. Show it to her and place her in her cage, giving her the treat as a reward. Try putting her in her cage at least a half hour before you are ready to turn out the lights, or to cover her cage if you do that at night. She needs some time to have a snack and get settled for sleeping. It is actually a good sign that she is bonding with you and wants to stay out with you. But it is important for birds to have time to themselves in their cage and not rely on being handled and entertained by a person all of the time. Otherwise if your lifestyle changes and you cannot handle her as often, this will be very hard on her. Make sure she has toys she enjoys and never treat going in the cage as a punishment. You can try gently holding her toes when she is on your hand, to prevent her from flying off when you near the cage. You may need to have her wings clipped by a professional until you get her trained to go into her cage. A flighted bird is much harder to train since she can just fly away. Her wing feathers will grow back next time she molts, so this is just a training method and not permanent. Also only feed her in her cage and this will give her incentive to spend time in her cage.
Thank you for asking Lafeber,