The optical properties of photopolymer layers consisting of an acrylamide-based matrix and microporous aluminophosphate nanocrystals of AEI-type are investigated. The compatibility of the photopolymer doped with the nanoparticles is studied. The surface and volume properties of the layers with different levels of doping with microporous nanocrystals are characterized. The effective refractive indices and absorption coefficients of the doped photopolymer layers are determined and used to calculate the refractive index and porosity of pure AEI nanoparticles used as dopants. Volume transmission gratings were recorded in the doped photopolymer layers at different spatial frequencies.By spatial monitoring of the characteristic Raman peak of the AEI particles across the grating vector, the optimal concentrations of the nanocrystals for obtaining highest light induced redistribution of nanocrystals are determined. The optical properties of the photopolymer layers combined with the redistribution of the AEI nanoparticles during holographic recording are the parameters exploited for fabrication of optical sensors. An irreversible humidity sensor based on a transmission holographic grating is designed and fabricated. The diffraction efficiency of the sensor changes permanently after exposure to high humidity.