A coherent feedback scheme is used to enhance the degree of squeezing of the output field in a cavity optomechanical system. In the feedback loop, a beam splitter (BS) plays the roles of both a feedback controller and an input-output port. To realize effective enhancement, the output quadrature should take the same form as the input quadrature, and the system should operate at the deamplification situation in the meantime. This can be realized by choosing an appropriate frequency-dependent phase angle for the generalized quadrature. Additionally, both the transmissivity of the BS and the phase factor induced by time delays in the loop affect optical squeezing. For the fixed frequency, the optimal values of transmissivity and phase factor can be used to achieve the enhanced optical squeezing. The effect of optical losses on squeezing is also discussed. Optical squeezing is degraded by the introduced vacuum noise owing to the inefficient transmission in the loop. We show that the enhancement of squeezing is achievable with the parameters of the current experiments.