A method for controlling the milking by a milking device comprises to provide (31) probability values for different milking parameter settings capable of being used for the milking of a milk producing animal; to draw (32) a milking parameter setting among the different milking parameter settings based on the probability values for the different milking parameter settings; to control (33) a milking of the milk producing animal such that the drawn milking parameter setting is used during the milking; to fetch (34) a sensed milk flow from the milk producing animal during the milking; to update (35) the probability values for the different milking parameter settings based on the fetched sensed milk flow; to draw (32) a further milking parameter setting among the different milking parameter settings based on the updated probability values for the different milking parameter settings; and to control (33) a following milking of the milk producing animal such that the drawn further milking parameter setting is used during the following milking. Such a method may allow optimised milk production, in terms of accuracy, precision, efficiency and reliability, as well as improved animal treatment.