The presence of hazards (e.g., contaminants, pathogens) in food/feed, water, plants, or animals can lead to major economic losses related to human and animal health or the rejection of batches of food or feed. Monitoring these hazards is important but can lead to high costs. This study aimed to find the most cost-effective sampling and analysis (S&A) plan in the cases of the mycotoxins deoxynivalenol (DON) in a wheat batch and aflatoxins (AFB1) in a maize batch. An optimization model was constructed, maximizing the number of correct decisions for accepting/rejecting a batch of cereals, with a budget as major constraint. The decision variables were the choice of the analytical method: instrumental method (e.g., liquid chromatography combined with mass-spectrometry (LC-MS/MS)), enzyme-linked-immuno-assay (ELISA), or lateral flow devices (LFD), the number of incremental samples collected from the batch, and the number of aliquots analyzed. S&A plans using ELISA showed to be slightly more cost effective than S&A plans using the other two analytical methods. However, for DON in wheat, the difference between the optimal S&A plans using the three different analytical methods was minimal. For AFB1 in maize, the cost effectiveness of the S&A plan using instrumental methods or ELISA were comparable whereas the S&A plan considering onsite detection with LFDs was least cost effective. In case of nonofficial controls, which do not have to follow official regulations for sampling and analysis, onsite detection with ELISA for both AFB1 in maize and DON in wheat, or with LFDs for DON in wheat, could provide cost-effective alternatives.