Bulk MgB2 samples were prepared under different synthesis conditions and analyzed by scanning and transmission electron microscopy. The critical current densities were determined from the magnetization versus magnetic field curves of bulk and powder-dispersed-in-epoxy samples. Results show that through a slow cooling process, the oxygen dissolved in bulk MgB2 at high synthesis temperatures can segregate and form nanometer-sized coherent precipitates of Mg(B,O)2 in the MgB2 matrix. Magnetization measurements indicate that these precipitates act as effective flux pinning centers and therefore significantly improve the intra-grain critical current density and its field dependence.