Ultrafine bubbles (UFBs) play a crucial role as catalysts in water treatment, pharmaceuticals, biomedical engineering, and industrial processes, particularly those involving heat transfer mechanisms. Several researchers in Indonesia have explored ultrafine bubble fluids' potential as a heat transfer medium in passive cooling system models. In this context, changes in the density of ultrafine bubble fluids serve as the primary driver for flow. Since ultrafine bubbles increase in diameter when heated, examining an optimal production model is essential to ensure their availability in the flow. This study aims to optimize the production of ultrafine bubble fluids with the lowest possible density compared to the base fluid (reference). The research investigates the effect of production time and volume variations on ultrafine bubble density in a closed-loop system. Production times of 30, 60, 90, 120, 150, and 180 minutes are tested across tank volumes of 20, 40, 50, and 60 liters. The closed-loop production model utilizes hydrodynamic cavitation to maintain continuous fluid flow, with sample collection occurring at 15-minute intervals after the initial production time to allow for stable bubble size. Observations and statistical analysis using the Response Surface Method (RSM) reveal a nonlinear relationship between production time and ultrafine bubble fluid density. The optimal density is achieved with a production time of 60 minutes for a 40-liter volume. Additionally, this closed-loop model increases the temperature of the ultrafine bubble fluid to 54.3 °C in a 20-liter volume. Heat accumulation occurs due to the continuous pump-driven flow without additional cooling systems.