Optical time of flight (ToF) sensors has potentials in the revolution of distance measurement. These sensors can continously monitor the distance and track the object movement. However, the existed sensing methods for such distance optical sensors mainly calculate the flight time e.g., pulse transit and receive time without considering theenvironment effects. Therefore, the measurement accuracy is severely reduced. There areother technologies with higher accuracy in the distance measurement. Nonetheless, they are too expensive due to the high accurate power supply. In this paper, we innovatievely improve the accuracy in continous distance measurement using the artificial neural network (ANN) technique. The proposed method can be applied for very cheap optical distance sensors with analog output in a real-time system.. Moreover, the propose method can self-calibrate and be miniaturized for such cheap analog sensor applications. The prototype is built with the infrared sensor GP2Y0A02YK0F and Arduino control board (add the name of Adruino board), the ANN is implemented using the deep learning algorithm. The test results show that the distance measurement accurary is significantly improved and the measuring range is increased from 15 to 150 cm. Also, we calculate MSE, MAE, MBE, and R2 for further perfomance evaluation. The experimental results have proved the superior of the proposed ANN method in optical distance measurement. The proposed method can be applied for many types of sensors