In the context of the use of liquid crystals (LCs) as lubricants and lubricant additives, this study investigates the anisotropic shear viscosity of LCs confined in nanometer-sized gap widths subject to both shearing and photoalignment. The photoalignment is achieved using anisotropically dimerized polyvinyl cinnamate (PVCi) films coated on substrates. We simultaneously measure the viscosity and order parameter of a liquid crystal (4-cyano-4'-pentylbiphenyl) confined and sheared in the gap range of 500 nm down to a few nm. We achieve this simultaneous measurement using an original method that combines a highly sensitive viscosity measurement and a sensitive birefringence measurement. When the LC is sheared in the same direction as the photoalignment (parallel shearing), the order parameter, which is around 0.3 in the bulk state, increases up to around 0.4 at a gap width of less than 50 nm and the viscosity is smaller than half the bulk viscosity. We consider that this increase in the order parameter is due to the highly ordered photoaligned LC layer near the PVCi film, and the viscosity decrease is due to shear thinning of this layer enhanced by both confinement and molecular ordering. In addition, we observe a gradual decrease in viscosity starting at a gap of less than around 300 nm in the parallel shearing. Based on the apparent slip model, we show that the LC layer near the PVCi film can also cause this gradual viscosity decrease. In contrast, when the LC is sheared in the direction perpendicular to the photoalignment direction (perpendicular shearing), the viscosity increases as the gap decreases. We speculate that this is due to the rotational motion of the LC molecules caused by the competing effect of shear alignment and photoalignment. We believe our findings can significantly contribute to a better understanding of the confined LCs utilized for lubrication.