A series of analytical nonautonomous soliton solutions for the (3+1)dimensional nonlinear Schrödinger equation with variable coefficients in the presence of gain (loss) and a harmonic potential are obtained. The explicit functions which describe the evolution of the amplitude, phase and velocity are also given. Soliton's phase and velocity are independent of the gain parameter, and only the amplitude is affected by the gain parameter. The dynamical behaviors for nonautonomous chirp-free and chirped solitons in a periodic distributed and dispersion decreasing systems are discussed. By modulating appropriate diffraction/dispersion parameters, we can trap the velocity of each soliton to control the interaction between soliton pairs. The real and imaginary parts of the spectral parameters control the separating or interacting behavior of chirp-free soliton pairs. However, the appearance of the chirp restrains the interaction between the chirped soliton pairs.