The current study is directed at the optimization and energy, exergy, and economic analyse of a solid oxide fuel cell, integrated with gas and steam trigeneration systems. The variables considered are the fuel cell's temperature and pressure, air-to-fuel molar ratio, the compressor and gas turbine pressure ratio, combustion chamber temperature, steam cycle pinch point. The objective functions are the exergy efficiency and the electricity cost. The results show that by selection of the optimal values of the fuel cell's temperature and pressure, air-to-fuel molar ratio, compressor and gas turbine pressure ratio, and the cycle pinch point as 809.8 K, 360 kPa, 2, 2.05, 11.6, and 34.9, the exergy efficiency is increased by 8%, and the produced electricity cost is reduced by 9.7%. The sensitivity analysis shows that an increase in compressor pressure ratio leads to a decrease in the energy and exergy efficiencies and entropy production rates. A change in air-to-fuel molar ratio from 2 to 3 causes the triple cycle electricity cost first to increase and then to decrease.