The generation and autoresonant excitation of a magnetic breather in a three-layer ferromagnet by fields of variable frequency and small amplitude in the presence of dissipation in the system is considered. The ferromagnetic structure consists of two wide identical layers separated by a thin layer with modified values of the magnetic anisotropy parameter. The anisotropy parameters are considered functions of the coordinate directed perpendicular to the layer interface. In the one-dimensional case, the function of the anisotropy parameter is modeled in the form of a rectangle. The external magnetic field is variable in time with a small amplitude and frequency, which is a linear function of time. The obtained equation of motion for magnetization in the form of a sine-Gordon equation was solved numerically using an explicit integration scheme. The distribution of magnetization at the initial time was set in the form of a Bloch domain boundary, located far from a thin layer. At certain values of the parameters of a thin layer, when a domain wall passes at a constant speed through it, a magnetic inhomogeneity is formed in the form of a magnetic breather. In the absence of an external field, the breather amplitude decays with time. An analysis of the solutions of the equation of motion in an alternating field shows the possibility, under certain conditions, of increasing with time the amplitude of the magnetic breather. For each case of magnetic anisotropy parameter values, there is a threshold value of the magnetic field amplitude leading to resonance. The resonance effect is also affected by the geometric parameters of a thin layer: with a decrease in the width of the layer, the amplitude of the breather increases more slowly in time. With a large layer width, the translational mode of breather oscillations is also excited.