Accurate prediction of egg-laying rate is of great significance in livestock and poultry farming. Feed intake and environmental factors such as temperature, humidity, carbon dioxide concentration, wind speed, light, and ammonia concentration are analyzed together to improve the accuracy of egg-laying rate prediction in this paper. And gray relation analysis is taken to analyze the correlation between the above factors and the egg-laying rate. A new prediction model is established based on a deep belief network and is optimized by particle swarm optimization. The results show that the proposed method significantly improved the prediction accuracy of the egg-laying rate.