Microcracking due to thermal stresses affects the mechanical and flow properties of rocks, which is significant for thermally dynamic environments such as volcanoes and geothermal reservoirs. Compared with other crustal rocks like granite, volcanic rocks have a complex and variable response to temperature; it remains unclear how thermal microcracks form and how they are affected by temperature. We heated and cooled samples of low-porosity basalts containing different amounts of microcracks and a porous andesite over three cycles, whilst monitoring microstructural changes by acoustic emission (AE) monitoring and measurement of P-wave velocity (vP; up to 450 degrees C) and thermal expansion coefficient (TEC; up to 700 degrees C). During the second and third cycles, the TEC was positive throughout and the rate of detected AE was low. In contrast to studies on granite, we measured a strong and reversible increase in vP with increasing temperature (by 15%-40% at 450 degrees C), which we interpret as due to microcrack closure. During the first cycle, AE and vP measurements indicated thermal microcracking within the andesite and the basalt with a low initial microcrack density. For these samples, strong inflexions in the TEC indicated stress relaxation during heating, preceding significant thermal microcracking during cooling. The basalt with a high initial microcrack density underwent little microcracking throughout all cycles. Our results and a review of the literature relate the initial microstructure to the occurrence of thermal microcracking and explore the potentially significant influence of temperature on volcanic rock properties. Microcracking due to thermal stresses affects the mechanical and flow properties of rocks, playing an important role within volcanoes and geothermal reservoirs. Volcanic rocks exhibit a complex response to temperature, and it remains unclear how thermal microcracks form and how they are affected by temperature. Here, we repeatedly heated and cooled samples of basalt and andesite with different initial porosities and microcrack content over three heating/cooling cycles, whilst monitoring for laboratory-scale seismicity and changes in acoustic wave velocity (up to 450 degrees C) and sample length (up to 700 degrees C). During the second and third cycles, we measured a strong, reversible increase in wave velocity with increasing temperature (by up to 40% at 450 degrees C): opposite to measurements on granite, and which we interpret as due to crack closure during heating. During cycle one, we detect thermal microcracking within the andesite and the basalt with a low initial microcrack population. For these samples, anomalous thermal expansion during heating is linked to the significant thermal microcracking during cooling. In contrast, the initially highly-microcracked basalt underwent little microcracking throughout. We relate the initial microstructure to the occurrence of thermal microcracking, and explore how rock properties may significantly change with temperature. One basalt cracked significantly during cooling, following an anomalous thermal expansion, indicative of stress relaxation, when heated All samples see an increase in wave velocity with temperature during repeated heating, attributed to microcrack closure during heating Our data literature study suggest low-porosity volcanic rocks with high P-wave velocities are most susceptible to thermal microcracking