The structural behavior of mm(3)-sized single crystals of YBa2Cu3O6+x with oxygen concentrations close to the metal-insulator transition is studied as a function of temperature, using 95-keV synchrotron x-ray diffraction. At x=0.36, no evidence is found of a room-temperature phase separation into tetragonal and orthorhombic phases, nor of a phase boundary between Ortho-II and tetragonal. Instead, we observe two distinct phase transitions: tetragonal to Ortho-I with a critical temperature T-OI=246(2) degrees C and Ortho-I to Ortho-II with T-OII 85(10) degrees C. Measurements of the spontaneous strain show the O/T transition to be nearly continuous with a critical exponent beta=0.34(2), consistent with a 3D Ising model driven weakly first order, presumably by the strain. A memory effect is observed, where relies of the twin domains-possibly related to tweed formations-continue to exist in the tetragonal phase when the temperature is increased above T-OI. Corresponding measurements for x=0.35 gave similar results with T-OI=181(2) degrees C, T-OII=95(10) degrees C, and beta=0.35(2)-but with the appearance of a small tetragonal component at room temperature. This component is interpreted as a nonequilibrium feature. In both cases the Ortho-I to Ortho-II transformations are very broad with a characteristic temperature dependence of the widths of the superstructure peaks that are similar to results obtained in a previous study for x=0.50. By comparison of the Ortho-II correlation lengths along a, b, and c with the corresponding data for x=0.50 we find evidence for a strong x dependency of ASYNNNI-type effective interaction parameters. The present results cannot be explained in terms of prevalent lattice gas models of the oxygen ordering and emphasizes the need for a theoretical basis that incorporates the strain and charge degrees of freedom.