We present photometric redshifts and spectral energy distribution (SED) classifications for a sample of 1542 optically identified sources detected with XMM in the COSMOS field. Our template fitting classifies 46 sources as stars and 464 as nonactive galaxies, while the remaining 1032 require templates with an active galactic nucleus (AGN) contribution. High accuracy in the derived photometric redshifts was accomplished as the result of (1) photometry in up to 30 bands with high-significance detections, (2) a new set of SED templates, including 18 hybrids covering the far-UV to mid-infrared, which have been constructed by the combination of AGNs and nonactive galaxies templates, and (3) multiepoch observations that have been used to correct ...