Does he do it during the day as well or just at night? If it's only at night, my guess would be he's doing it for attention. The thing is, without knowing it, you've trained him to bark until he gets let out. The only way to cure this is by letting him bark and bark until he stops and not give in. When you put a dog in a crate, the only time he should be allowed out is if he's quiet. No barking, no whining, no excited bit, nothing. Since you're in an apartment and have neighbours, you can't go through with this method. Unless you speak to them and have their permission. Then I would suggest you either temporarily go to a place where you can "cure" him for a few days and then come back to your place. If you're determined and follow through, depending how long it's been going on, it can be done in 2 or 3 days. Or, maybe you can do it at your place by doing it during the day. Start training in the morning. Put him in his crate and only let him out when he has not made a noise for at least 10 minutes. Then do it again 2 hours later. When he's in the crate and whining and barking, you don't talk to him or go near him. Only go to the crate when he's been quiet for 10 minutes (look at your watch to make sure it's been long enough). Maybe if you do this 3 or 4 times during the day, he'll be okay for the night. Don't lose courage, it will get better.