This paper presents a method of using optical sensor for mobile robot localization, which improves the accuracy of position estimation by using extended Kalman filter to fuse three kinds of sensor data. By installing the optical mouse sensor on the edge of the robot's central axis, the linear and angular speed of the robot can be calculated. These help to solve the problem of wheel-slip and the accumulation error of yaw angle that obtained by low-cost MEMS IMU (Inertial Measurement Unit). An extended Kalman filter method that fuse the data from wheel encoder, IMU and optical mouse sensor is implemented. Eventually, experiments of position estimation were carried out on our own two-wheel drive robot. By comparing the accuracy of fusion algorithm in many ways, it indicated that the location result that of three kinds of sensors is better than that of one or two sensors in traditional way, and the error of position estimation is generally within 0.6%.