Due to climate protection and increasing oil prices, renewable energy is becoming extremely important. Anaerobic digestion is a particular environmental and resource-saving way of heat and power production in biogas plants. These plants can be operated decentralized and independent of weather conditions and allow peak load operation. To maximize energy production, plants should be operated at a high efficiency. That means the entire installed power production capacity (e.g. CHP) and biogas production have to be used. However, current plant utilization in many areas is significantly lower, which is economically and environmentally inefficient, since the biochemical process responds to fluctuations in boundary conditions, e.g. mixing in the conditions and substrate composition. At present only a few easily accessible parameters such as fill level, flow rates and temperature are determined on-line. Monitoring of substrate composition occurs only sporadically with the help of laboratory methods. Direct acquisition of substrate composition combined with a smart control and regulation concept enables significant improvement in plant efficiency. This requires a compact, reliable and cost-efficient sensor. It is for this reason that a MEMS sensor system based on NIR spectroscopy has been developed. Requirements are high accuracy, which is the basic condition for exact chemometric evaluation of the sample as well as optimized MEMS design and packaging in order to work in poor environmental conditions. Another issue is sample presentation, which needs an exact adopted optical-mechanical system. In this paper, the development and application of a MEMS-based analyzer for biogas plants will be explained. The above mentioned problems and challenges will be discussed. Measurement results will be shown to demonstrate its performance.