Help!! I don't know what to do

My baby latches very well most of the time but sometimes he would cry and look for my boob so I try to feed him and he latches on for 3 seconds then lets go of my nipple and stars crying and looking around for my nipple again and latches on again and then lets go in 3 seconds and this just keeps repeating over and over. What do I do?! Maybe I'm doing something wrong?