A method of controlling a milking device and the milking device (3) are disclosed. The milking device comprises a milking unit (6, 7, 8) which is provided with at least one teat cup (66) and with a connecting unit (65) for, preferably automatically, connecting the teat cup (66) to a teat of a dairy animal (2). The milking device (3) further comprises a measuring sensor which issues a measurement signal representative of the milk production, an identification unit (18) for enabling the identification of an individual dairy animal (2), and a control unit (9). The control unit (9) is connected to the measuring sensor and the control unit (9) is configured to determine a milking frequency in a first manner, associated with a first lactation phase, in a second, different manner, associated with a later, second lactation phase. The first and the second lactation phase are the stimulation phase and the stable phase of the lactation period of the dairy animal (2), and the first manner results in a higher milking frequency than the second manner in the same circumstances. The control unit (9) is configured to milk the 5 identified dairy animal (2) with the milking unit (6, 7, 8) in dependence on the determined milking frequency associated with the identified dairy animal (2) and the control unit (9) is further configured to switch from the first lactation phase to the second lactation phase for the identified dairy animal (2) in dependence on the measurement signal for the milk production of the dairy animal (2) received from the measuring sensor (15). The control unit (9) is configured to determine a change in the milk production of the identified animal (2) and the control unit (9) is further configured to switch from the first lactation phase to the second lactation phase for the identified dairy animal (2) in dependence on the change in milk production. The control unit (9) is connected to a memory in which a threshold value is stored and wherein the control unit (9) is