An image sensor device is provided. The image sensor device includes a substrate, a plurality of photoelectric conversion units for collecting image signals disposed in the substrate, a first dielectric layer disposed upon the substrate, a plurality of metal layers disposed in the first dielectric layer, a trench disposed in the first dielectric layer and located between the adjacent metal layers, a filling material filled in the trench, a second dielectric layer disposed upon the first dielectric layer, and a light source or a detected object disposed over the second dielectric layer. The metal layer adjacent to the substrate is defined as a first metal layer. The metal layer adjacent to the top of the first dielectric layer is defined as a top metal layer. The trench extends from the top of the first dielectric layer towards the substrate to the first metal layer.