Limiting weight gain during pregnancy

Hello, mommies, I'm asking how to limit weight gain while pregnant while still giving baby and myself all the nutrients we need. My first pregnancy I gained between 40-50lbs and was around 378lbs, my biggest yet! I recently lost over 100lbs and I'm scared, I don't want to gain a whole lot of weight, I know I will gain some, I just want it at a minimal. Last time I gave into all my craving and I know that I can't do that anymore being I didn't like the after math. Any advice would be appreciated.