Self-operation and outsourcing cooperation have emerged as the prevailing operating mode for logistics companies in the realm of sharing logistics. This mode facilitates the rational and effective coordination of multiple resources for task assignment. However, the competition and cooperation relationship between self-operation and outsourcing remain largely unexplored, leaving logistics companies grappling with the trade-off between cost-effectiveness and risk. To address this gap, we propose a multi-stage resource leveling model that accounts for the fuzzy outsourcing resources, the efficacy of intra-stage resources, and the stability of inter-stage resources. We employ an improved gravitational search algorithm to solve this model efficiently. Inspired by Markowitz's portfolio theory, we propose a resource portfolio strategy under the self-operation and outsourcing cooperation mode based on the mean-variance model to better weigh up the “cost-effectiveness” and “risk” exhibited by logistics resources. The strategy uses expected returns and variance to evaluate the benefits and risks, thereby categorizing allocation schemes according to risk levels. Finally, through experiment analysis, we discuss the optimal scale of self-operation and outsourcing resources for logistics subtasks at different risk levels. This analysis equips logistics companies with the insights needed to make informed decisions aligned with their risk preferences and overall benefits, offering crucial managerial implications for business and strategic decisions.