Out of curiosity, when you let him out in the middle of the night, are the lights off in the house/room where the crate is? Perhaps when you are putting him into the crate at bed time the house is still lit, but he's scared of the dark? I don't know. Either way, as another said, I would just plop him back, give him the treat, give him a pet and positive reinforcement, and say good night!