The bond distance in CO is 112.8 pm, while the bond distance in NO is 115 pm. Thus carbon has shorter bond in CO because Carbon has one fewer valence electron than nitrogen. We also know that Lone pairs are essentially nonbonding electrons, which arise from more filled antibonding orbitals. Filling antibonding orbitals decreases bond order, which in turn decreases bond strength and increases bond length. Thus the more lone pairs around , the longer will be your bonds.