The widespread use of the internet to communicate with each other can introduces data security issues. Therefore, a reliable technique to secure information is becoming mandatory. Data hiding is a method to secure data by hiding it in cover media. In this research, we present a secure data hiding method by using images as cover. This research proposed the use of prediction error (PE) of images and utilization of the histogram-based method to conceal data. The histogram-based method can conceal data and still preserve the quality of the image. However, its lower hiding space can be a drawback. To overcome this, instead of using a histogram from the image's pixel, we calculate the error value of images and create a histogram from it. After that, we divide the histogram into partitions, whose peak is as the reference point for the embedding process. We utilize more than one error value in each partition to further increase the embedding space. Based on the experimental result, with the same image dataset, the average of PSNR values improved by 17.94 dB for general images and 14.95 dB for medical images compared to previous methods. These increases are statistically significant for the visual image quality, where the final PSNR values are between 61 and 66 dB, and between 62 and 68 dB for general and medical images, respectively. It is higher than the minimum standard of stego image quality, which is 30 dB.