Routing protocols in Mobile Ad Hoc Networks (MANETs) play a pivotal role in ensuring quality of service (QoS) and improving network performance. Selection of optimal routing protocol and suitable parameters for a given network scenario is a major task that ultimately affects the behavior of network. This work exploits machine learning (ML) techniques for the selection of adequate routing parameters and protocol by regression of parameters in given network scenario to ensure optimal performance. The network is trained based on parametric setup of expanding ring search mechanism (ERS) and random early detection (RED) technique to estimate network throughput, end to end (E2E) delay and packets delivery ratio (PDR) and is tested via wide-ranging simulations in varying network topologies. Both RED and ERS mechanisms are aimed to control link and node level congestion in the reactive routing protocols and our aim is to select the best suited parameters for given network topologies based on ERS and RED parametric setups and improve performance for ensuring QoS. ML algorithms are trained and tested for their performance in varying network topologies. We have exploited these models with best performance for ERS and RED based routing in given topological arrangements. The performance of the ML algorithms is evaluated on the basis of root mean squared error (RMSE) and mean absolute error (MAE) for regression settings. Prediction models with up to par RMSE and MAE out-turns are attained and exploited for selection of suitable ERS and RED parameters and routing protocols in order to ensure the QoS for given network scenario. Variants of standard routing protocols are devised based on their performance and the ML techniques are exploited for prediction of QoS parameters to decide on the optimal variant that attains significant improvement in performance. Results are shown to confirm that considerable improvement in QoS is attained. INDEX TERMS Ad hoc multi hop wireless networks, congestion control, expanding ring search, machine learning, mobile ad hoc networks, on demand routing protocols, random early detection, regression, quality of service.