Why would I wake up in the middlw of a surgery....When I had been under sedation.?

Light sedation? There are varying degrees of sedation; with light sedation you may be somewhat awake, and usually a local or regional anesthetic is used to relieve pain, without deep sleep. Deep sedation, as in general anesthesia implies complete loss of awareness, and you would not usually be awake. Occasionally depth of anesthesia or sedation is difficult to judge, and there may be awareness, but this is rare.
Call anesthesia Dr. Iv sedation ("twilight") is designed to make you comfortable and relaxed during a procedure (often in conjunction with local anesthesia), but not necessarily unconscious. I can speculate why you may have woken up during your procedure, but it is best if you talk directly with your anesthesiologist to find out why. I can assure you they will want to know about your experience.
Biology. Sedation is variable biology. Each person eliminates drugs differently. We cannot measure your sleepiness directly. We guess based on your heart rate and pressure and other things. General with gas is reliable physics, we can measure the depth on your breath. So you will not wake up unless a mistake is made. If you are awake with normal vital signs and your eyes closed we do not know it.
Sedation . Under mild sedation, you may be aware what is going on during a simple procedure vs. Deeper sedation.