The detection process of Escherichia coli (E. coli) bacteria in drinking water is a global problem as they can lead to hazardous conditions in the human body. In this work, a one-dimensional binary photonic crystal with the structure air/(GaAs,SiO2) N /D/(GaAs,SiO2) N /glass is proposed as an optical sensor to detect E. coli bacteria, where D is the defect layer. Water and E. coli bacteria are treated as the defect layer. The sensing mechanism of the proposed detector is based on the refractive index difference between pure water and waterborne bacteria samples. The transmission spectra of the photonic crystal are investigated and the sensitivity to E. coli bacteria is calculated. The effects of the central wavelength and the angle of incidence on the sensitivity and sensor performance parameters are studied. It is found that the central wavelength increase can enhance the sensor sensitivity and most of the performance parameters. Increasing the incidence angle can improve the sensitivity and all the performance parameters such as full width at half maximum, quality factor, detection limit, sensor resolution, signal-to-noise ratio, dynamic range, detection accuracy and figure of merit.