Designers of energy systems often face challenges in balancing the trade-off between cost and reliability. In literature, several papers have presented mathematical models for optimizing the reliability and cost of energy systems. However, the previous models only addressed reliability implicitly, i.e., based on availability and maintenance planning. Others focused on allocation of reliability based on individual equipment requirements via non-linear models that require high computational effort. This work proposes a novel mixed-integer linear programming (MILP) model that combines the use of both input-output (I-O) modelling and linearized parallel system reliability expressions. The proposed MILP model can optimize the design and reliability of energy systems based on equipment function and operating capacity. The model allocates equipment with sufficient reliability to meet system functional requirements and determines the required capacity. A simple pedagogical example is presented in this work to illustrate the features of proposed MILP model. The MILP model is then applied to a polygeneration case study consisting of two scenarios. In the first scenario, the polygeneration system was optimized based on specified reliability requirements. The technologies chosen for Scenario 1 were the CHP module, reverse osmosis unit and vapour compression chiller. The total annualized cost (TAC) for Scenario 1 was 53.3 US$ million/year. In the second scenario, the minimum reliability level for heat production was increased. The corresponding results indicated that an additional auxiliary boiler must be operated to meet the new requirements. The resulting TAC for the Scenario 2 was 5.3% higher than in the first scenario.