A semiconductor laser includes an optical waveguide formed on a semiconductor substrate and capable of generating gain by current injection, and a diffraction grating having a phase shift and provided along the optical waveguide over the overall length of the optical waveguide on the semiconductor substrate. The semiconductor laser is configured such that a Bragg wavelength in a region in the proximity of each of the opposite ends of the optical waveguide is longer than a Bragg wavelength in a region in the proximity of the phase shift in a state in which current injection is not performed for the optical waveguide.