Photolithography was used in combination with photocleavable self-assembled monolayers to pattern surface free energies inside microchannels enabling the control of the boundary between immiscible liquids. While aqueous solutions are confined to the hydrophilic pathways by surface forces alone, organic liquids are confined to the hydrophobic region only if the aqueous liquid first occupies the hydrophilic region. In this way, stable liquid boundaries between immiscible liquids are possible as long as the pressures are maintained below critical values. The maximum pressures are determined by the interfacial tension of the aqueous solution and organic liquid, channel depth, and advancing contact angle (theta;(a)). Experimental results on maximum pressures are in good agreement with the analytical values. The ability to confine and position the boundary between immiscible liquids inside microchannels leads to a broad range of applications in microfluidic systems, which is exemplified by fabrication of a semipermeable membrane in a surface-patterned channel via interfacial polymerization.