Purpose This study aims to propose a force control algorithm based on neural networks, which enables a robot to follow a changing reference force trajectory when in contact with human skin while maintaining a stable tracking force. Design/methodology/approach Aiming at the challenge of robots having difficulty tracking changing force trajectories in skin contact scenarios, a single neuron algorithm adaptive proportional – integral – derivative online compensation is used based on traditional impedance control. At the same time, to better adapt to changes in the skin contact environment, a gated recurrent unit (GRU) network is used to model and predict skin elasticity coefficients, thus adjusting to the uncertainty of skin environments. Findings In two robot–skin interaction experiments, compared with the traditional impedance control and robot force control algorithm based on the radial basis function model and iterative algorithm, the maximum absolute force error, the average absolute force error and the standard deviation of the force error are all decreased. Research limitations/implications As the training process of the GRU network is currently conducted offline, the focus in the subsequent phase is to refine the network to facilitate real-time computation of the algorithm. Practical implications This algorithm can be applied to robot massage, robot B-ultrasound and other robot-assisted treatment scenarios. Originality/value As the proposed approach obtains effective force tracking during robot–skin contact and is verified by the experiment, this approach can be used in robot–skin contact scenarios to enhance the accuracy of force application by a robot.