It's not impossible to grow lettuce throughout the summer, but it does take a little extra thought. First, choose leaf varieties rather than head forming lettuces. You can cut leaf lettuces as soon as the outer leaves reach about 4-6 inches in height. Cut just these outer leaves and allow the center leaves to continue growing. This is called 'Cut and Come Again' and it tends to shock the lettuce plant, preventing it from thinking it has matured and should go to seed or bolt.
Secondly, plant your lettuce in the shade of taller plants, like tomatoes, corn, or even vining crops like cucumbers and squash. You can do this when you first start seeding, in the spring, or when there are bare spots in the garden to fill. Although lettuce needs more sun in the cool spring than it does in summer, positioning lettuce plants around taller plants, like tomatoes, will provide full sun in spring while the tomatoes are still short, but will offer relief from the intense summer sun.
Thirdly, regular watering makes plants very forgiving. Water your lettuce plants everyday, more if it is extremely hot and dry. The leaves, which are mostly water, will desiccate and wilt in strong sunlight and dry soil. Lettuce roots tend to be shallow, so it's more important to water often, than to water deeply.
If all else fails and it looks like your lettuce plants are ready to bolt, dig them out of the ground and replant them.
As with 'cut and come again', this is a shock to the plant's system and your lettuce seedling will once again focus on growing roots and put off setting seed. Don't keep them out of the ground or allow them to dry out. Just the act of lifting them is enough of a shock.