This data collection contains spatially resolved single-cell transcriptomics datasets acquired using MERFISH on the mouse periaqueductal gray (PAG) from mice exposed to one of several different behavioral paradigms. Data were collected by the laboratories of Prof. Xiaowei Zhuang and Prof. Catherine Dulac at Harvard University and Howard Hughes Medical Institute. The data collection is composed of 27 experiments. In each experiment the brain of a naive adult mouse or a behaviorally-stimulated adult mouse was imaged using MERFISH, collecting data from 10-µm thick coronal slices taken at evenly-spaced intervals across the extent of the PAG. Most experiments were performed using slices spaced apart by 200 µm, and all slices were placed on a single coverslip and imaged together. For some experiments, a higher slice density was used, with slices spaced by 100 µm, and in these cases the anterior slices were placed on one coverslip and the posterior slices were placed on another coverslip, and they were imaged separately. In all cases 12-13 slices were placed on a coverslip, and each slice was imaged with 81 fields-of-view (FOV) arranged as a 9-by-9 array centered on the aqueduct. Each FOV covers 223 µm by 223 µm in x and y, and the centers of each FOV were separated by 200 µm. Each experiment imaged 262 marker genes and 26 activity-related genes. Of the marker genes, 258 were imaged using MERFISH, with each gene encoded by a unique, error-robust barcode using a 20 bit binary encoding scheme. The barcodes were imprinted onto the RNAs using a complex pool of encoding probes. The 20 bits were imaged using 10 rounds of two-color imaging. The remaining 4 marker genes were imaged with sequential FISH, using two rounds of two-color imaging, plus an additional round acquired using no fluorescent probes to estimate local background. The 26 activity-related genes were imaged using MERFISH as described for the marker genes, but only 10 bits were used for error-robust encoding of these genes. These 10 bits were imaged using 5 rounds of two-color imaging. All bits used for MERFISH imaging of the 258 marker genes were imaged in 6 z-planes spaced apart by 1.5 µm, starting at 0 µm and ending at 7.5 µm above the surface of the coverglass. All bits used for sequential marker gene imaging or MERFISH imaging of activity-related genes were imaged in a single z-plane 4.5 µm above the surface of the coverglass. The "image_data" folder contains the MERFISH image data. Experiments are organized into folders based on the behavioral condition. In each behavioral condition folder, each experiment is contained within a folder named according to the behavioral condition and biological replicate number (e.g. Male_naive_animal_2, Male_naive_animal_3, Female_naive_animal_1, etc). In the cases where the imaging was split across two coverslips, data are organized as above but with "anterior" or "posterior" appended to the name. Each experiment contains an "Aligned_images" and a "Deconvolved_images" folder. In the "Aligned_images" folder, each FOV is present as a single file, with the images from all the bits and z planes combined into a single multi-frame tiff file that was then compressed with zstandard. Each image has been corrected for x-y drift that occurred during the rounds of imaging using fiducial beads. Aligned images are named aligned_images{FOV}.tif.zstd, where {FOV} is the number of the FOV used for that set of images. In the "Deconvolved_images" folder, the files are the same as described for the aligned images, but with the additional processing step in which the images were high-pass filtered and deconvolved using parameters described in preprocessing_parameters.json. These processed images are named processed_images{FOV}.tif.zstd, where {FOV} is the number of the FOV used for that set of images. The "fov_coordinates" folder contains a csv file for each experiment, named according to the behavioral condition and biological replicate number of the animal as described above. Each file contains three columns, the first column is the number of the FOV, the second and third columns are the x and y coordinates of the fov (in µm), respectively. These coordinates can be used to arrange the FOVs of an experiment as they were arranged on the coverslip. The supplementary_files folder contains the files listed in the "Sample analysis metadata" section of the dataset_metadata_June 2020.csv, including lists of the genes analyzed, encoding probe sequences for theses genes, codebooks, and the data organization file.