We have demonstrated a novel approach to achieve a stable second-order NLO polymer by incorporating NLO moieties into a processable epoxy polymer and hardening with crosslinkable sol-gel technique. The crosslinked polymer showed high nonlinearity (d(33) = 41 pm/V) and better thermal stability compared to the prepolymer, which maintained its nonlinearity up to 100 degrees C without significant loss of NLO activity.