In order to understand the temperature distribution of Rayleigh-Bénard (R–B) flow of cyclohexane/oxygen mixture to avoid the potential hazard of deflagration, we presented a series of three-dimensional numerical simulations on the aspect ratio dependence of three-dimensional R–B flow of cyclohexane/oxygen mixture with the density maximum in rectangular containers. Results show that with increasing the aspect ratio (A), the sidewall's restriction weakens gradually, the critical Rayleigh (Ra) numbers for the steady flow onset and the oscillatory convection appearance decrease gradually. When A = 0.25 and 0.5, all the critical flow patterns are the single straight roll state. The types of the stable flow patterns are few and the evolutions of flow patterns are relatively simple. When A ≥ 1, the critical flow patterns change with the increasing density inversion parameter (Θm) and the evolution becomes more complicated. With the increasing Ra, the oscillation gets more apparent and the oscillatory frequency increases. When Θm = 0.4, the flow rolls swing back and forth along the sidewalls and the fundamental frequency is the highest at A = 0.25. With the increasing Ra and A, and the decreasing Θm, the heat transfer strengthens. Finally, a scaling relationship for the average Nusselt number in terms of Ra, Θm and A is proposed.