offer a few more times during the day to keep the nursing connection.
feed him more, especially around bedtime. maybe some cow milk too if you do cow milk.
give it some time to settle down.
my DD is just over three, and i'm almost 24 weeks pregnant. the first trimester was hard. she was adjusting to having less milk, and waking up hungry all the time, or announcing she's hungry at bedtime.
lately, the past month or so, she's sleeping through the night.
as for the pain, i just decided early on to suck it up. i want to tandem and am bound and determined to nurse through the pregnancy.
the initial latch on is still painful, but thereafter it stops hurting. she claims she is getting milk - i can't know for sure. but she continues to be an avid nurser. i offer throughout the day, and don't refuse, although occasionally i put her off if i'm too busy at the moment she wants.
i guess my advice for the painful latch at night would be to try to minimize this nursing session. (by feeding him more so he's less hungry -- also try to wear him out more, so he goes to sleep more easily -- at least for the time being. you also might find that things "calm down" in the months ahead and that this is a particularly rough patch right now).
but in order to keep him nursing, you may need to establish other times for more awake suckling, such as first thing in the morning? that's a big important time around here.