Wireless multimedia sensor networks (WMSNs) have stringent constraints and need to deliver data packets to the sink node within a predefined limited time. However, due to congestion, buffer overflow occurs and leads to the degradation of the quality-of-service (QoS) parameters of event information. Congestion in WMSNs results in exhausted node energy, degraded network performance, increased transmission delays, and high packet loss. Congestion occurs when the volume of data trying to pass through a network exceeds its capacity. First, the BOCC protocol uses two congestion indicators to detect congestion. One is the buffer occupancy and other is the buffer occupancy change rate. Second, a rate controller is proposed to protect high-priority I-frame packets during congestion. BOCC sends a congestion notification to the source node to reduce congestion in the network. The source node adjusts its data transmission rate after receiving the congestion notification message. In the proposed algorithm, the rate adjustment is made by discarding low-priority P-frame packets from the source nodes. Third, to further improve the performance of the BOCC protocol, the problem is formulated as a constrained optimization problem and solved using convex optimization and sequential quadratic programming (SQP) methods. Experimental results based on Raspberry Pi sensor nodes show that the BOCC protocol achieves up to 16% reduction in packet loss and up to 23% reduction in average end-to-end delay compared to state-of-the-art congestion control algorithms.