In this work, the design and simulation of high-sensitivity gas optical sensor (GOS), based on photonic crystals with refractive index different of linear materials is presented. The lattice index is cubic and the dielectric rods are made of silicon and are designed in a square shape. In the proposed optical sensor, three resonance nanocavities are used, the central nanocavity is made of silicon with a refractive index of nSi = 2.6, and the sub-nanocavities located in the path of the input waveguide and the output waveguide This optical sensor is able to detection of N2, He and CO2 gases from the air. Numerical simulation results are obtained using two-dimensional FDTD method. The use of three resonance nanocavities and the distances between the dielectric rods increased the sensitivity and quality factor of the structure. The proposed optical sensor has a sensitivity of S = 400 nm/RIU and a quality factor of Q.f = 1080.615, and the power transmission is about TE = 100%. The figure of merit is equal to FOM = 258.333 ± 8.333 RIU-1. It is designed to integrate the structure with small dimensions as much as possible. The overall dimensions of the structure are 72.6 µm2, which can be easily used in optically integrated circuits