sympathies to you - I think you are being very tolerant of his carefree lifestyle.
Taking a long term view, my dh was a man who went out most nights for a few hours or more and I remember feeling apprehensive when I was pregnant...then cross because things were slow to change once I had my baby ds... or when ds grew into a toddler even... but slowly as the years went by, dh became more of a homebody, and if he goes out now will visit the pub round the corner for a pint in the evening - and that's fine with me.
But pre children, our lifestyle was not very 'couple -y' I was happy about dh going out to see his friends for a few hours most evenings - I was always invited along but ususally chose not to. Sometimes I dropped by unexpectedly and was always welcomed and sometimes I saw my own friends.
I think you have to ask yourself how you see life after your baby. IME it is difficult to put into action a drastic change of lifestyle overnight, especailly if you have been happy for your dh to go out a lot pre children. But you have got to set limits!
I'd think about getting a babysitter on board soon, just so that you know when you are ready to, you can both go out together. Not having a babysitter to call on and having a husband who may still be eager to go out with his friends sometimes, is not a nice situation to be in. Even if you don't use the babysitter much, knowing you can go out if you want to is really important for your state of mind IMO.
And also make sure from day one, or as soon as possible, that your dh knows how to look after your baby. Leave them together as soon as you can. This is really important - make sure your dh is hands on, has sole responsibility sometimes while you go out.
Being positive about his involvement and responsiblity towards his child is a great, positive way of curbing his going out lifestyle IMO.
I hope this is helpful - I do feel worried on your behalf that your dh has had to resit both years so far of his degree, and you say when he goes out, he stays out all night. It sounds like he has some growing up to do.