I used to be bad at names. Now I've become somewhat better. What's helped is: when I hear their name, I say it back to them: once loud (as in, "Hi John! Nice to meet you."), and several times after that in my mind ("that's John, I just met him"). I'll revisit his name a few times with increasing delays in between, and after a couple of iterations, it's baked in.
Another thing that helps: if you notice something weird, latch on to it immediately. It could be anything: something he's wearing or about his voice or his looks (a guy I met recently had a Facebook style t-shirt with a thumbs down and "meh" instead of the 'like'; I made a note of it, and now, even a couple of weeks later, associate him with that t-shirt). These techniques have helped me remember names of up to 20-25 new people in a night of socializing.