In photoacoustic imaging, the speed of sound distribution (SoS) of background is required for image reconstruction, though, in general, it may not be known exactly before reconstruction. The estimation of SoS in a layered media is a difficult task due to the nonlinearity of the wave propagation. In this work, we proposed a novel hybrid focusing metric for accurate image quality assessment in an autofocusing approach to estimate the speed of sound distribution of layered media. In the proposed metric, contrast resolution and spatial resolution information were combined into a novel hybrid focusing metric by exploiting intensity-based focusing metrics and pixel count metrics, thus, enhancing the accuracy of estimation. We have compared the performance of the proposed metric with state of art focusing metrics Brenner, Tennenbaum, and Normalized Variance through numerical simulations which were conducted through k-Wave toolbox. and proved that the proposed focusing metric improved the performance of autofocusing approach significantly in layered media.