We report the electronic structure study of intermetallic CeCo2 nanothin films of various thicknesses by X-ray absorption near-edge structure (XANES) spectroscopy at Ce L3-, Co K-, and L2,3-edges. The Ce L3-edge absorption spectra reveal that the contribution of tetravalent Ce component increases with the film thickness, and all investigated nanothin films exhibit intermediate valence nature. Variation of the spectral intensities observed at the Co K-edge threshold implies modification in the Co 3d states and the enhancement of 3d-4f-5d hybridization. The Co 3d and Ce 4f occupation numbers were estimated from these spectroscopic results. The present study brings out how the surface-to-bulk ratio and the charge transfer between Ce and Co ions affect the electronic structure of nanothin films.