The phenomenon of Dirac neutrino oscillations in medium of varying density and composition is studied for the case of three lepton generations using the Berry adiabatic approach. The expressions for the topological phases γN are derived. It is shown that the Berry phases, arising when matter parameters vary periodically, are equal to zero identically, while in the case of noncyclic evolution, γN≢0 (in a special gauge) under the condition that all matrix elements of the flavor-mixing matrix in vacuum, CP-violating (Dirac) phase and neutrino-mass-squares differences are not equal to zero simultaneously. Exact formulas for the neutrino-mixing matrix in matter and adiabatic time-evolution operator are obtained. The recursion algorithm for the calculation of corrections to the adiabatic approximation is given