The Internet of Things (IoT) is an emerging paradigm that is transforming real-world things (objects) into smarter devices. IoT is applicable to a variety of application domains including healthcare, smart grid, and agriculture. This domain has started revolutionizing the agriculture industry by providing smart solutions for precision farming, greenhouse management, and livestock monitoring. This article aims to present a comprehensive survey on the role of IoT in the Livestock field by categorizing and synthesizing existing research work in this area. To this end, a detailed discussion has been provided on IoT network infrastructure, topologies and platforms employed for livestock management. In addition, a list of communication protocols and connections of IoT-based livestock systems with relevant technologies have also been explored. Furthermore, numerous IoT-based livestock monitoring, controlling, and tracking applications have been discussed. Apart from this, it also analyses distinct security issues in IoT-based livestock field and developed a collaborative security model to detect and minimize the security risk. Lastly, pertinent open research challenges in the domain of IoT-based livestock management have been presented with future research directions.