Estimation technical project is always one of the the hardest thing in Project Management.
There are so many moving factors that can easily affect the quality of Estimation, especially under certain conditions like time constrains and resource shortage.
One of the good lessons I got is to add contingency into the estimation regardless. If we deliver things earlier than the deadline, that’s a good surprise. Otherwise, we still get enough buffer to get things done and deliver.
A good rule of thumb is about adding 50% contingency to your original estimation.
If you prefer more rational approach, you could try is with this PERT Estimation method. This is to give you a weighted estimation based on most likely, optimistic, and pessimistic estimations.
I knew you like to read books, this particular books is been recommended by couple of people to me around Estimation and Planning. Worth to have a read Agile Estimation and Planning if you get some time.