Fiber Bragg gratings (FBGs) with Gaussian apodization profiles and zero de index change are studied extensively and optimized for optical filtering in 40-Gb/s single-channel and WDM systems with channel spacing of 100 and 200 GHz, for a single filter and for a cascade of optical filters. In the single-filter case, the optimized FBG leads practically to the same performance for single-channel and WDM systems, due to its low crosstalk introduction. The optimized filter is nonflat-top, with delay distortion below 7 ps, -3 dB bandwidth between 60 and 90 GHz, and is very robust to a variation of the grating length and the dc effective index change. For a cascade of optical filters and a WDM system with channel spacing of 100 GHz, the FBG must be designed carefully due to a tradeoff between crosstalk and accumulated distortion. This tradeoff leads to 1.2 dB of sensitivity degradation relative to the single-filter case, and the optimized filter approaches the flat-top response with -3 dB bandwidth between 110 and 130 GHz and delay distortion of about 3 ps. For a 200-GHz channel spacing, that tradeoff is lessened and the FBG optimization is mainly ruled by the distortion accumulation.