A controller for an internal combustion engine, wherein the internal combustion engine includes an in-cylinder injection valve that opens when a coil is energized to inject fuel into a combustion chamber of the internal combustion engine, a supply passage that supplies fuel to the in-cylinder injection valve, and a high-pressure fuel pump that supplies pressurized fuel to the supply passage, the controller comprising: a fuel pressure control processor configured to operate the high-pressure fuel pump and control a fuel pressure detected in the supply passage at a target fuel pressure; an instruction value calculating processor configured to calculate a peak instruction value (Ipeak*) from the detected fuel pressure, wherein the peak instruction value (Ipeak*) is a peak value of current that flows through the coil; the controller being characterized in that it further comprises: an upper limit guard processor configured to execute a guard process with an upper limit guard value (Ith) on the peak instruction value (Ipeak*) calculated by the instruction value calculating processor; an energizing processor configured to energize the coil based on the peak instruction value (Ipeak*) that has undergone the guard process; a convergence determination processor configured to determine whether or not the detected fuel pressure has converged on the target fuel pressure; and a decreasing processor configured to decrease the upper limit guard value (Ith) to a lower value when the convergence determination processor determines that the fuel pressure has converged on the target fuel pressure than when the convergence determination processor determines that the fuel pressure has not converged on the target fuel pressure. a fuel pressure control processor configured to operate the high-pressure fuel pump and control a fuel pressure detected in the supply passage at a target fuel pressure; an instruction value calculating processor configured to calculate a peak instruction value (Ipeak*) from the detected fuel pressure, wherein the peak instruction value (Ipeak*) is a peak value of current that flows through the coil; the controller being characterized in that it further comprises: an upper limit guard processor configured to execute a guard process with an upper limit guard value (Ith) on the peak instruction value (Ipeak*) calculated by the instruction value calculating processor; an energizing processor configured to energize the coil based on the peak instruction value (Ipeak*) that has undergone the guard process; a convergence determination processor configured to determine whether or not the detected fuel pressure has converged on the target fuel pressure; and a decreasing processor configured to decrease the upper limit guard value (Ith) to a lower value when the convergence determination processor determines that the fuel pressure has converged on the target fuel pressure than when the convergence determination processor determines that the fuel pressure has not converged on the target fuel pressure. an upper limit guard processor configured to execute a guard process with an upper limit guard value (Ith) on the peak instruction value (Ipeak*) calculated by the instruction value calculating processor; an energizing processor configured to energize the coil based on the peak instruction value (Ipeak*) that has undergone the guard process; a convergence determination processor configured to determine whether or not the detected fuel pressure has converged on the target fuel pressure; and a decreasing processor configured to decrease the upper limit guard value (Ith) to a lower value when the convergence determination processor determines that the fuel pressure has converged on the target fuel pressure than when the convergence determination processor determines that the fuel pressure has not converged on the target fuel pressure.