The optimal design of borehole thermal energy storage systems can ensure their techno-economical goals are met. Current design optimization methods either employ detailed modelling unsuitable for numerical optimization or use simplified models that do not consider operational conditions. This paper proposes an optimization-oriented model and a non-convex optimization formulation that, differently from other studies in the literature, can consider the influence of the seasonal storage size and temperature on its capacity, losses, heat transfer rate, and efficiency of connected heat pumps or chillers. This methodology was applied to a case study, considering two scenarios: storing only the rejected heat from cooling and integrating solar thermal generation. Results show that, with varying boundary conditions such as the electricity CO2 intensity profile, cooling demand, and price of carbon emissions, not only the optimal seasonal storage size changes but also its optimal operating conditions. The potential reduction of CO2 emissions was found, under standard boundary conditions, to be limited (up to 6.7%), but an increase in cooling demand and an enhancement of the CO2 intensity seasonal variation led to a reduction of 27.1%. Integration of solar generation further improved it to 43.7%, with a comparably small increase in annual cost, up to 6.1%.