New styryl dyes of the pyridine and benzothiazole series were synthesized with the aim of investigating the solid-state [2+2] autophotocycloaddition (PCA) reaction. The 1H NMR spectroscopy showed that for most of the compounds under study, the visible light irradiation of thin polycrystalline films of the dyes affords cyclobutane derivatives. The rate of the photoreaction depends on the structure of the dye and is higher for compounds, which contain a short N-substituent in the heterocyclic moiety and have strong absorption in the visible region. Dyes bearing electron-releasing substituents in the benzene ring undergo the stereospecific PCA in the syn-head-to-tail dimeric pair to give the only rctt isomer of cyclobutane derivatives. Electron-withdrawing and bulky substituents in the benzene fragment of styryl dyes extend the range of the mutual orientations of the molecules in the dimeric pairs, resulting in the formation of two or even four isomeric cyclobutanes in the PCA reactions. The structures of some dyes were established by X-ray diffraction. In the overwhelming majority of the structures, one of two packing modes, either syn-head-to-tail or syn-head-to-head, with extensive stacking interactions is observed. A rare example of the anti-head-to-head stacking mode was found for the dicationic dye containing the bulky N+(Et)Me2 substituent in the benzene ring. The syn-head-to-tail and anti-head-to-head stacking modes can facilitate the PCA reaction due to the close spatial proximity of the ethylenic bonds and their parallel orientation in the dimeric pairs of the dye molecules.