In this work, long high-quality fiber Bragg gratings with phase shifts in the structure are inscribed directly in the optical fiber by point-by-point technique using femtosecond laser pulses. Phase shifts are introduced during the inscription process with a piezoelectric actuator, which rapidly shifts the fiber along the direction of its movement in a chosen point of the grating with a chosen shift value. As examples, single and double π phase shifts are introduced in fiber Bragg gratings with a length up to 34 mm in passive fibers, which provide corresponding transmission peaks with bandwidth less than 1 pm. It is shown that 37 mm π-phase-shifted grating inscribed in an active Er-doped fiber forms high-quality DFB laser cavity generating single-frequency radiation at 1550 nm with bandwidth of 20 kHz and signal-to-noise ratio of >70 dB. The inscription technique has a high degree of performance and flexibility and can be easily implemented in fibers of various types.