You can remove the capability using remove_cap, here you can see a list per role of all capabilities available, the one you want would be edit_pages, so this will work for the editor rol, which has that capability:
$role = get_role( 'editor' );
$role->remove_cap( 'edit_pages' );
you may want publish_pages, edit_posts,publish_posts too, check the table for the rols that have those capabilities, take into account that you need to do this 1 time only, the remove_cap will modify the value in the database from 1 to 0, so run it only 1 time, here is how an WP_Role object looks:
WP_Role Object
(
[name] => subscriber
[capabilities] => Array
(
[read] => 1
[level_0] => 1
)
)
as you can see a subscriber can only read, notice that only the capabilities with 1 (true) will be saved.
You can also create your own rol and add capabilities to it, thats another topic though =]