This research involves the multi-period optimization of an agricultural-type biogas supply network to produce electricity, heat and organic fertilizer. A mixed-integer linear programming (MILP) model utilizing a four-layer biogas supply chain is put forward. The model accounts for biogas plants based on two different guaranteed electricity purchase prices depending on capacity (up to 999 kW and up to 4,999 kW) and on hourly auction trading prices. In case of fixed electricity prices, monthly periods are considered, while in the case of market prices, variability on an hourly basis is accounted for. An illustrative case study of agricultural biogas plants in Slovenia where up to three biogas plants could be selected was modelled. Technologies could include an anaerobic digester, press-based dewatering and a combined heat and power plant (CHP), while water, electricity, and heat required for the anaerobic digestion plant itself could be “recycled”. Four scenarios are presented based on different electricity prices and market price variability. The first two scenarios based on monthly time periods consider guaranteed purchase prices of electricity (206 $/MWh for biogas plants up to 999 kW capacity and 187 $/MWh for biogas plants up to 4,999 kW capacity), while the last two scenarios consider auction trading prices changing every hour at different biogas production capacities, and thus the model is based on hourly time periods. The first two scenarios showed three biogas plants with profit after tax of 663,624 $/y and 6,089,559 $/y with various dry matter contents ranging from 4.2 to 13 %. Alternatively, the last two scenarios showed losses incurred with optimal dry matter contents close to 13 %. This study provides the answers to the effects of realistic hourly variation in electricity price on a biogas supply chain network in comparison to subsidized prices based on monthly time periods.