We investigate the sign problem in field theories by using the path optimization method with use of the neural network. For theories with the sign problem, integral in the complexified variable space is a promising approach to obtain a finite (non-zero) average phase factor. In the path optimization method, the imaginary part of variables are given as functions of the real part, $y_i=y_i({x})$, and are optimized to enhance the average phase factor. The feedforward neural network can be used to give and to optimize functions with many variables. The combined framework, the path optimization with use of the neural network, is applied to the complex $phi^4$ theory at finite density, the 0+1 dimensional QCD at finite density, and the Polyakov loop extended Nambu-Jona-Lasinio (PNJL) model, all of which have the sign problem. In these cases, the average phase factor is found to be enhanced significantly. In the complex $phi^4$ theory, it is demonstrated that the number density is calculated at a high precision. On the optimized path, the imaginary part is found to have strong correlation with the real part on the temporal nearest neighbor site. In the 0+1 dimensional QCD, we compare the results in two different treatments of the link variable: optimization after the diagonal gauge fixing and optimization without the diagonal gauge fixing. These two methods show consistent eigenvalue distribution of the link variables. In the PNJL model with homogeneous field ansatz, finite volume results approach the mean field results as expected, and the phase transition behavior can be described.