The simulated annealing is used to synthesize two-dimensional photonic crystals so that the band gaps are enlarged and shifted. The simulated annealing is a probabilistic and iterative algorithm suitable for many optimization problems. Here the plane wave expansion method is adopted for calculating the band structure at each iteration. Then the photonic crystal can be optimized after iterations. Besides, we employ similar procedure to synthesize photonic crystals with low group velocity for both the TE and TM modes and at various wave vectors. The numerical results show that the simulated annealing can effectively be used to synthesize photonic crystals subject to different specifications.