The rapid proliferation of Internet of Things (IoT) devices has fundamentally transformed the digital landscape, enabling unprecedented connectivity and automation. However, this expansion has also introduced significant security vulnerabilities, primarily due to the resource-constrained nature of many IoT devices. Among the most critical threats is the Man-in-the-Middle (MITM) attack, where malicious actors intercept, alter, or inject data into communication channels between devices and servers. This chapter explores the intricate mechanisms of MITM attacks within IoT ecosystems and proposes robust, scalable methodologies for secure data transmission. By evaluating and comparing cryptographic protocols such as Transport Layer Security (TLS) and Datagram Trans port Layer Security (DTLS) across common IoT communication standards like Message Queuing Telemetry Transport (MQTT) and Constrained Application Protocol (CoAP), we provide a comprehensive framework for mitigating interception risks. The proposed methodology integrates end-to-end encryption with robust certificate-based authentica tion. Extensive simulation results demonstrate the efficacy of the proposed architecture in detecting and preventing MITM attacks while maintaining acceptable network perfor mance metrics, including latency, throughput, and packet loss.