In this paper we report the results of an extended study of the effect of sugar doping on the structural and electromagnetic properties of MgB2 superconductors. High values of the upper critical field (Bc2) of 36 T and the irreversibility field (Birr) of 27 T have been estimated at the temperature of 5 K in a bulk MgB2 sample with the addition of 10 wt% of sugar. The critical current density (Jc(Ba)) of sugar-doped samples has been significantly improved in the high field region. The value of transport Jc has reached as high as 108 A m-2 at 10 T and 5 K for Fe-sheathed sugar-doped MgB2 wire. The analysis of the pinning mechanism in the samples investigated indicated that dominant vortex pinning occurs on the surface type of pinning defects, such as grain boundaries, dislocations, stacking faults etc, for both pure and doped MgB2. In sugar-doped samples, pinning is governed by numerous crystal lattice defects, which appear in MgB2 grains as a result of crystal lattice distortion caused by carbon substitution for boron and nano-inclusions. The drastically improved superconducting properties of sugar-doped samples are also attributed to the highly homogeneous distribution and enhanced reactivity of this dopant with host Mg and B powders. The results of this work suggest that sugar is the optimal source of carbon for doping MgB2 superconductor, especially for application at high magnetic fields.