The invention provides a method of controlling an
internal combustion engine (1) in a vehicle comprising a cylinder (301, 302), a fuel
system (330) for supplying fuel to the cylinder, an air guide (901) arranged to guide an air flow to the cylinder (301, 302), and an exhaust guide (501, 502) arranged to guide a gas flow from the cylinder (301, 302), the method comprising - controlling the engine to provide a braking torque, the control comprising, - terminating (S1) the supply of fuel to the cylinder (301, 302), - restricting (S4) the flow through the exhaust guide (501, 502), and - restricting (S6) the flow through the air guide (901), - wherein the control of the engine to provide a braking torque also comprises - determining (S5) a value of a rotational speed of a
turbocharger (4) of the engine, and - adjusting (S6), in dependence on the determined
turbocharger rotational speed value, the restriction of the flow through the air guide (901), and / or the restriction of the flow through the exhaust guide (501, 502).