To restore and protect the ecosystem service function of coastal zones, some farmers have changed their certain original production methods and lifestyles and some have even relinquished a portion of the economic benefits that could be obtained directly. What impacts do the coastal zone ecological protection policies bring to the livelihoods of coastal farmers? The strict coastline protection of Beibu Gulf, Hepu County, Beihai City, Guangxi Zhuang Autonomous Region, China, is taken as an example. Combined with the sustainable livelihood framework (SLF), this paper set up an evaluation index system for the livelihood capital of farmers in the Beibu Gulf coastal zone, obtaining 568 valid questionnaires through a field survey, and use the propensity score matching and difference-in-difference (PSM-DID) method to study the impacts of a coastal ecological protection policy on the livelihood capital of coastal farmers from the perspective of farmer participation. The results show that (1) the coastal ecological protection policy had a significant impact on the natural capital and social capital of coastal farmers that actively participated in coastal ecological protection, which increased by 0.181 and 0.052, respectively. (2) However, it did not have a significant impact on the total livelihood capital, human capital, physical capital or financial capital. Therefore, this paper presents policy suggestions for constructing coastal ecological compensation mechanisms and for promoting active participation by coastal farmers in coastal ecological protection efforts.