This paper focuses on a two-layer approach to genetic programming algorithm and the improvement of the training process using ensemble learning. Inspired by the performance leap of deep neural networks, the idea of a multilayered approach to genetic programming is proposed to start with two-layered genetic programming. The goal of the paper was to design and implement a twolayer genetic programming algorithm, test its behaviour in the context of symbolic regression on several basic test cases, to reveal the potential to improve the learning process of genetic programming and increase the accuracy of the resulting models. The algorithm works in two layers. In the first layer, it searches for appropriate sub-models describing each segment of the data. In the second layer, it searches for the final model as a non-linear combination of these sub-models. Two-layer genetic programming coupled with ensemble learning techniques on the experiments performed showed the potential for improving the performance of genetic programming.