Abstract Tuberculosis is one of the most widespread infectious and deadliest diseases in the world. The death percentage is larger than that in the case of the current Coronavirus. Bio-photonic sensors represent a promising option for developing reliable, simple, and affordable tools for the effective detection of tuberculosis. In this paper, a novel design of an optical biosensor will be used as a tuberculosis detector based on a resonance cavity with high sensitivity in one-dimensional photonic crystals demonstrated theoretically. The results show that the increase of the defect layer thickness shifts the defect mode to a longer wavelength region. Besides, it is shifted to a shorter wavelength region via the increase of the incidence angle. The change in thickness of the defect layer and incident angle of light cause an optimization for our suggested structure and the sensitivity reaches 1390 nm/RIU. Our structure is very simple for industrial design.